Package org.swtchart.internal.series
Class LineSeries
- java.lang.Object
-
- org.swtchart.internal.series.Series
-
- org.swtchart.internal.series.LineSeries
-
- All Implemented Interfaces:
ILineSeries
,ISeries
public class LineSeries extends Series implements ILineSeries
Line series.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.swtchart.ILineSeries
ILineSeries.PlotSymbolType
-
Nested classes/interfaces inherited from interface org.swtchart.ISeries
ISeries.SeriesType
-
-
Field Summary
-
Fields inherited from class org.swtchart.internal.series.Series
chart, compressor, DEFAULT_SERIES_TYPE, id, isXMonotoneIncreasing, maxX, maxY, minX, minY, seriesLabel, stackEnabled, stackSeries, type, visible, xAxisId, xErrorBar, xSeries, yAxisId, yErrorBar, ySeries
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LineSeries(Chart chart, java.lang.String id)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
draw(GC gc, int width, int height, Axis xAxis, Axis yAxis)
Draws series.void
drawSeriesSymbol(GC gc, int h, int v, Color color)
Draws series symbol.void
enableArea(boolean enabled)
Enables the area chart.void
enableStep(boolean enabled)
Enables the step chart.Range
getAdjustedRange(Axis axis, int length)
Gets the adjusted range to show all series in screen.int
getAntialias()
Gets the anti-aliasing value for drawing line.Color
getLineColor()
Gets the line color.LineStyle
getLineStyle()
Gets line style.int
getLineWidth()
Gets the line width.Color
getSymbolColor()
Gets the symbol color.Color[]
getSymbolColors()
Gets the symbol colors.int
getSymbolSize()
Gets the symbol size in pixels.ILineSeries.PlotSymbolType
getSymbolType()
Gets the symbol type.boolean
isAreaEnabled()
Gets the state indicating if area chart is enabled.boolean
isStepEnabled()
Gets the state indicating if step chart is enabled.void
setAntialias(int antialias)
Sets the anti-aliasing value for drawing line.protected void
setCompressor()
Sets the compressor.void
setLineColor(Color color)
Sets line color.void
setLineStyle(LineStyle style)
Sets line style.void
setLineWidth(int width)
Sets the width of line connecting data points and also line drawing symbol if applicable (i.e.void
setSymbolColor(Color color)
Sets the symbol color.void
setSymbolColors(Color[] colors)
Sets the symbol colors.void
setSymbolSize(int size)
Sets the symbol size in pixels.void
setSymbolType(ILineSeries.PlotSymbolType type)
Sets the symbol type.-
Methods inherited from class org.swtchart.internal.series.Series
addDisposeListener, dispose, draw, enableStack, getCompressor, getDescription, getId, getLabel, getPixelCoordinates, getRangeWithMargin, getType, getXAxisId, getXDateSeries, getXErrorBar, getXRange, getXSeries, getYAxisId, getYErrorBar, getYRange, getYSeries, isDateSeries, isStackEnabled, isValidStackSeries, isVisible, isVisibleInLegend, setDescription, setStackSeries, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.swtchart.ISeries
addDisposeListener, enableStack, getDescription, getId, getLabel, getPixelCoordinates, getType, getXAxisId, getXDateSeries, getXErrorBar, getXSeries, getYAxisId, getYErrorBar, getYSeries, isStackEnabled, isVisible, isVisibleInLegend, setDescription, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
-
-
-
-
Constructor Detail
-
LineSeries
protected LineSeries(Chart chart, java.lang.String id)
Constructor.- Parameters:
chart
- the chartid
- the series id
-
-
Method Detail
-
getLineStyle
public LineStyle getLineStyle()
Description copied from interface:ILineSeries
Gets line style.- Specified by:
getLineStyle
in interfaceILineSeries
- Returns:
- line style.
-
setLineStyle
public void setLineStyle(LineStyle style)
Description copied from interface:ILineSeries
Sets line style. If null is given, default line style will be set.- Specified by:
setLineStyle
in interfaceILineSeries
- Parameters:
style
- line style
-
getLineColor
public Color getLineColor()
Description copied from interface:ILineSeries
Gets the line color.- Specified by:
getLineColor
in interfaceILineSeries
- Returns:
- the line color
-
setLineColor
public void setLineColor(Color color)
Description copied from interface:ILineSeries
Sets line color. If null is given, default color will be set.- Specified by:
setLineColor
in interfaceILineSeries
- Parameters:
color
- the line color
-
getLineWidth
public int getLineWidth()
Description copied from interface:ILineSeries
Gets the line width.- Specified by:
getLineWidth
in interfaceILineSeries
- Returns:
- the line width
-
setLineWidth
public void setLineWidth(int width)
Description copied from interface:ILineSeries
Sets the width of line connecting data points and also line drawing symbol if applicable (i.e. PlotSymbolType.CROSS or PlotSymbolType.PLUS). The default width is 1.- Specified by:
setLineWidth
in interfaceILineSeries
- Parameters:
width
- the line width
-
getSymbolType
public ILineSeries.PlotSymbolType getSymbolType()
Description copied from interface:ILineSeries
Gets the symbol type.- Specified by:
getSymbolType
in interfaceILineSeries
- Returns:
- the symbol type
-
setSymbolType
public void setSymbolType(ILineSeries.PlotSymbolType type)
Description copied from interface:ILineSeries
Sets the symbol type. If null is given, default type PlotSymbolType.CIRCLE will be set.- Specified by:
setSymbolType
in interfaceILineSeries
- Parameters:
type
- the symbol type
-
getSymbolSize
public int getSymbolSize()
Description copied from interface:ILineSeries
Gets the symbol size in pixels.- Specified by:
getSymbolSize
in interfaceILineSeries
- Returns:
- the symbol size
-
setSymbolSize
public void setSymbolSize(int size)
Description copied from interface:ILineSeries
Sets the symbol size in pixels. The default size is 4.- Specified by:
setSymbolSize
in interfaceILineSeries
- Parameters:
size
- the symbol size
-
getSymbolColor
public Color getSymbolColor()
Description copied from interface:ILineSeries
Gets the symbol color.- Specified by:
getSymbolColor
in interfaceILineSeries
- Returns:
- the symbol color
-
setSymbolColor
public void setSymbolColor(Color color)
Description copied from interface:ILineSeries
Sets the symbol color. If null is given, default color will be set.- Specified by:
setSymbolColor
in interfaceILineSeries
- Parameters:
color
- the symbol color
-
getSymbolColors
public Color[] getSymbolColors()
Description copied from interface:ILineSeries
Gets the symbol colors.- Specified by:
getSymbolColors
in interfaceILineSeries
- Returns:
- the symbol colors, or empty array if no symbol colors are set.
-
setSymbolColors
public void setSymbolColors(Color[] colors)
Description copied from interface:ILineSeries
Sets the symbol colors. Typically, the number of symbol colors is the same as the number of plots. If the number of symbol colors is less than the number of plots, the rest of plots will have the common color which is set with setSymbolColor(Color).- Specified by:
setSymbolColors
in interfaceILineSeries
- Parameters:
colors
- the symbol colors. If null or empty array is given, the color which is set with setSymbolColor(Color) will be commonly used for all plots.
-
setCompressor
protected void setCompressor()
Description copied from class:Series
Sets the compressor.- Specified by:
setCompressor
in classSeries
-
enableArea
public void enableArea(boolean enabled)
Description copied from interface:ILineSeries
Enables the area chart.- Specified by:
enableArea
in interfaceILineSeries
- Parameters:
enabled
- true if enabling area chart
-
isAreaEnabled
public boolean isAreaEnabled()
Description copied from interface:ILineSeries
Gets the state indicating if area chart is enabled.- Specified by:
isAreaEnabled
in interfaceILineSeries
- Returns:
- true if area chart is enabled
-
enableStep
public void enableStep(boolean enabled)
Description copied from interface:ILineSeries
Enables the step chart.- Specified by:
enableStep
in interfaceILineSeries
- Parameters:
enabled
- true if enabling step chart
-
isStepEnabled
public boolean isStepEnabled()
Description copied from interface:ILineSeries
Gets the state indicating if step chart is enabled.- Specified by:
isStepEnabled
in interfaceILineSeries
- Returns:
- true if step chart is enabled
-
getAdjustedRange
public Range getAdjustedRange(Axis axis, int length)
Description copied from class:Series
Gets the adjusted range to show all series in screen. This range includes the size of plot like symbol or bar.- Specified by:
getAdjustedRange
in classSeries
- Parameters:
axis
- the axislength
- the axis length in pixels- Returns:
- the adjusted range
-
getAntialias
public int getAntialias()
Description copied from interface:ILineSeries
Gets the anti-aliasing value for drawing line. The default value is SWT.DEFAULT.- Specified by:
getAntialias
in interfaceILineSeries
- Returns:
- the anti-aliasing value which can be SWT.DEFAULT, SWT.ON or SWT.OFF.
-
setAntialias
public void setAntialias(int antialias)
Description copied from interface:ILineSeries
Sets the anti-aliasing value for drawing line.If number of data points is too large, the series is drawn as a collection of dots rather than lines. In this case, the anti-alias doesn't really make effect, and just causes performance degradation. Therefore, client code may automatically enable/disable the anti-alias for each series depending on the number of data points, or alternatively may let end-user configure it.
- Specified by:
setAntialias
in interfaceILineSeries
- Parameters:
antialias
- the anti-aliasing value which can be SWT.DEFAULT, SWT.ON or SWT.OFF.
-
draw
protected void draw(GC gc, int width, int height, Axis xAxis, Axis yAxis)
Description copied from class:Series
Draws series.
-
drawSeriesSymbol
public void drawSeriesSymbol(GC gc, int h, int v, Color color)
Draws series symbol.- Parameters:
gc
- the GC objecth
- the horizontal coordinate to draw symbolv
- the vertical coordinate to draw symbolcolor
- the symbol color
-
-