org.swtchart.internal.series
Class LineSeries

java.lang.Object
  extended by org.swtchart.internal.series.Series
      extended by 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
protected LineSeries(Chart chart, java.lang.String id)
          Constructor.
 
Method Summary
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, getId, getLabel, getPixelCoordinates, getRangeWithMargin, getType, getXAxisId, getXDateSeries, getXErrorBar, getXRange, getXSeries, getYAxisId, getYErrorBar, getYRange, getYSeries, isDateSeries, isStackEnabled, isValidStackSeries, isVisible, isVisibleInLegend, 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, getId, getLabel, getPixelCoordinates, getType, getXAxisId, getXDateSeries, getXErrorBar, getXSeries, getYAxisId, getYErrorBar, getYSeries, isStackEnabled, isVisible, isVisibleInLegend, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
 

Constructor Detail

LineSeries

protected LineSeries(Chart chart,
                     java.lang.String id)
Constructor.

Parameters:
chart - the chart
id - the series id
Method Detail

getLineStyle

public LineStyle getLineStyle()
Description copied from interface: ILineSeries
Gets line style.

Specified by:
getLineStyle in interface ILineSeries
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 interface ILineSeries
Parameters:
style - line style

getLineColor

public Color getLineColor()
Description copied from interface: ILineSeries
Gets the line color.

Specified by:
getLineColor in interface ILineSeries
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 interface ILineSeries
Parameters:
color - the line color

getLineWidth

public int getLineWidth()
Description copied from interface: ILineSeries
Gets the line width.

Specified by:
getLineWidth in interface ILineSeries
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 interface ILineSeries
Parameters:
width - the line width

getSymbolType

public ILineSeries.PlotSymbolType getSymbolType()
Description copied from interface: ILineSeries
Gets the symbol type.

Specified by:
getSymbolType in interface ILineSeries
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 interface ILineSeries
Parameters:
type - the symbol type

getSymbolSize

public int getSymbolSize()
Description copied from interface: ILineSeries
Gets the symbol size in pixels.

Specified by:
getSymbolSize in interface ILineSeries
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 interface ILineSeries
Parameters:
size - the symbol size

getSymbolColor

public Color getSymbolColor()
Description copied from interface: ILineSeries
Gets the symbol color.

Specified by:
getSymbolColor in interface ILineSeries
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 interface ILineSeries
Parameters:
color - the symbol color

getSymbolColors

public Color[] getSymbolColors()
Description copied from interface: ILineSeries
Gets the symbol colors.

Specified by:
getSymbolColors in interface ILineSeries
Returns:
the symbol colors, or null 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).

By default, null is set.

Specified by:
setSymbolColors in interface ILineSeries
Parameters:
colors - the symbol colors. If null 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 class Series

enableArea

public void enableArea(boolean enabled)
Description copied from interface: ILineSeries
Enables the area chart.

Specified by:
enableArea in interface ILineSeries
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 interface ILineSeries
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 interface ILineSeries
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 interface ILineSeries
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 class Series
Parameters:
axis - the axis
length - 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 interface ILineSeries
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 interface ILineSeries
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.

Specified by:
draw in class Series
Parameters:
gc - the graphics context
width - the width to draw series
height - the height to draw series
xAxis - the x axis
yAxis - the y axis

drawSeriesSymbol

public void drawSeriesSymbol(GC gc,
                             int h,
                             int v,
                             Color color)
Draws series symbol.

Parameters:
gc - the GC object
h - the horizontal coordinate to draw symbol
v - the vertical coordinate to draw symbol
color - the symbol color