public class LineSeries extends Series implements ILineSeries
ILineSeries.PlotSymbolType
ISeries.SeriesType
Modifier and Type | Field and Description |
---|---|
private static int |
ALPHA
the alpha value to draw area
|
private int |
antialias
the anti-aliasing value for drawing line
|
private boolean |
areaEnabled
the state indicating if area chart is enabled
|
private static int |
DEFAULT_ANTIALIAS
the default anti-aliasing value
|
private static int |
DEFAULT_LINE_COLOR
the default line color
|
private static LineStyle |
DEFAULT_LINE_STYLE
the default line style
|
private static int |
DEFAULT_LINE_WIDTH
the default line width
|
private static int |
DEFAULT_SIZE
the default symbol size
|
private static int |
DEFAULT_SYMBOL_COLOR
the default symbol color
|
private static ILineSeries.PlotSymbolType |
DEFAULT_SYMBOL_TYPE
the default symbol type
|
private org.eclipse.swt.graphics.Color |
lineColor
the line color
|
private LineStyle |
lineStyle
the line style
|
private int |
lineWidth
the line width
|
private static int |
MARGIN_AT_MIN_MAX_PLOT
the margin in pixels attached at the minimum/maximum plot
|
private boolean |
stepEnabled
the state indicating if step chart is enabled
|
private org.eclipse.swt.graphics.Color |
symbolColor
the symbol color
|
private org.eclipse.swt.graphics.Color[] |
symbolColors
the symbol colors
|
private int |
symbolSize
the symbol size in pixel
|
private ILineSeries.PlotSymbolType |
symbolType
the symbol type
|
chart, compressor, DEFAULT_SERIES_TYPE, id, isXMonotoneIncreasing, maxX, maxY, minX, minY, seriesLabel, stackEnabled, stackSeries, type, visible, xAxisId, xErrorBar, xSeries, yAxisId, yErrorBar, ySeries
Modifier | Constructor and Description |
---|---|
protected |
LineSeries(Chart chart,
java.lang.String id)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private static void |
addPoint(java.util.List<java.lang.Integer> pointList,
int x,
int y,
boolean isHorizontal) |
protected void |
draw(org.eclipse.swt.graphics.GC gc,
int width,
int height,
Axis xAxis,
Axis yAxis)
Draws series.
|
private void |
drawArea(org.eclipse.swt.graphics.GC gc,
int[] p,
boolean isHorizontal)
Draws the area.
|
private static void |
drawLine(org.eclipse.swt.graphics.GC gc,
Axis xAxis,
Axis yAxis,
double[] xseries,
double[] yseries,
boolean isHorizontal) |
private void |
drawLineAndArea(org.eclipse.swt.graphics.GC gc,
int width,
int height,
Axis xAxis,
Axis yAxis)
Draws the line and area.
|
private static void |
drawLineWithStyle(org.eclipse.swt.graphics.GC gc,
Axis xAxis,
Axis yAxis,
double[] xseries,
double[] yseries,
boolean isHorizontal)
Draws the line segments with line style.
|
void |
drawSeriesSymbol(org.eclipse.swt.graphics.GC gc,
int h,
int v,
org.eclipse.swt.graphics.Color color)
Draws series symbol.
|
private void |
drawSymbolAndLabel(org.eclipse.swt.graphics.GC gc,
int width,
int height,
Axis xAxis,
Axis yAxis)
Draws series symbol, label and error bars.
|
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.
|
org.eclipse.swt.graphics.Color |
getLineColor()
Gets the line color.
|
private int[] |
getLinePoints(double[] xseries,
double[] yseries,
int[] indexes,
int index,
Axis xAxis,
Axis yAxis)
Gets the line points to draw line and area.
|
LineStyle |
getLineStyle()
Gets line style.
|
int |
getLineWidth()
Gets the line width.
|
org.eclipse.swt.graphics.Color |
getSymbolColor()
Gets the symbol color.
|
org.eclipse.swt.graphics.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(org.eclipse.swt.graphics.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(org.eclipse.swt.graphics.Color color)
Sets the symbol color.
|
void |
setSymbolColors(org.eclipse.swt.graphics.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.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
private int symbolSize
private org.eclipse.swt.graphics.Color symbolColor
private org.eclipse.swt.graphics.Color[] symbolColors
private ILineSeries.PlotSymbolType symbolType
private LineStyle lineStyle
private org.eclipse.swt.graphics.Color lineColor
private int lineWidth
private boolean areaEnabled
private boolean stepEnabled
private int antialias
private static final int ALPHA
private static final LineStyle DEFAULT_LINE_STYLE
private static final int DEFAULT_LINE_WIDTH
private static final int DEFAULT_LINE_COLOR
private static final int DEFAULT_SYMBOL_COLOR
private static final int DEFAULT_SIZE
private static final ILineSeries.PlotSymbolType DEFAULT_SYMBOL_TYPE
private static final int DEFAULT_ANTIALIAS
private static final int MARGIN_AT_MIN_MAX_PLOT
protected LineSeries(Chart chart, java.lang.String id)
chart
- the chartid
- the series idpublic LineStyle getLineStyle()
ILineSeries
getLineStyle
in interface ILineSeries
public void setLineStyle(LineStyle style)
ILineSeries
setLineStyle
in interface ILineSeries
style
- line stylepublic org.eclipse.swt.graphics.Color getLineColor()
ILineSeries
getLineColor
in interface ILineSeries
public void setLineColor(org.eclipse.swt.graphics.Color color)
ILineSeries
setLineColor
in interface ILineSeries
color
- the line colorpublic int getLineWidth()
ILineSeries
getLineWidth
in interface ILineSeries
public void setLineWidth(int width)
ILineSeries
setLineWidth
in interface ILineSeries
width
- the line widthpublic ILineSeries.PlotSymbolType getSymbolType()
ILineSeries
getSymbolType
in interface ILineSeries
public void setSymbolType(ILineSeries.PlotSymbolType type)
ILineSeries
setSymbolType
in interface ILineSeries
type
- the symbol typepublic int getSymbolSize()
ILineSeries
getSymbolSize
in interface ILineSeries
public void setSymbolSize(int size)
ILineSeries
setSymbolSize
in interface ILineSeries
size
- the symbol sizepublic org.eclipse.swt.graphics.Color getSymbolColor()
ILineSeries
getSymbolColor
in interface ILineSeries
public void setSymbolColor(org.eclipse.swt.graphics.Color color)
ILineSeries
setSymbolColor
in interface ILineSeries
color
- the symbol colorpublic org.eclipse.swt.graphics.Color[] getSymbolColors()
ILineSeries
getSymbolColors
in interface ILineSeries
public void setSymbolColors(org.eclipse.swt.graphics.Color[] colors)
ILineSeries
setSymbolColors
in interface ILineSeries
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.protected void setCompressor()
Series
setCompressor
in class Series
public void enableArea(boolean enabled)
ILineSeries
enableArea
in interface ILineSeries
enabled
- true if enabling area chartpublic boolean isAreaEnabled()
ILineSeries
isAreaEnabled
in interface ILineSeries
public void enableStep(boolean enabled)
ILineSeries
enableStep
in interface ILineSeries
enabled
- true if enabling step chartpublic boolean isStepEnabled()
ILineSeries
isStepEnabled
in interface ILineSeries
public Range getAdjustedRange(Axis axis, int length)
Series
getAdjustedRange
in class Series
axis
- the axislength
- the axis length in pixelspublic int getAntialias()
ILineSeries
getAntialias
in interface ILineSeries
public void setAntialias(int antialias)
ILineSeries
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.
setAntialias
in interface ILineSeries
antialias
- the anti-aliasing value which can be SWT.DEFAULT,
SWT.ON or SWT.OFF.private int[] getLinePoints(double[] xseries, double[] yseries, int[] indexes, int index, Axis xAxis, Axis yAxis)
xseries
- the horizontal seriesyseries
- the vertical seriesindexes
- the series indexesindex
- the index of seriesxAxis
- the X axisyAxis
- the Y axisprotected void draw(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)
Series
private void drawLineAndArea(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)
gc
- the graphics contextwidth
- the width to draw seriesheight
- the height to draw seriesxAxis
- the x axisyAxis
- the y axisprivate static void drawLine(org.eclipse.swt.graphics.GC gc, Axis xAxis, Axis yAxis, double[] xseries, double[] yseries, boolean isHorizontal)
private static void drawLineWithStyle(org.eclipse.swt.graphics.GC gc, Axis xAxis, Axis yAxis, double[] xseries, double[] yseries, boolean isHorizontal)
When there are multiple data points at the same x pixel coordinate, it is inefficient to simply draw vertical lines connecting them by overlaying. Instead, only a single vertical line representing the overlaid multiple vertical lines is drawn at that x pixel coordinate.
That's why vertical line is handled differently from non-vertical line in this method.
gc
- the graphic contextxAxis
- the x axisyAxis
- the y axisxseries
- the x seriesyseries
- the y seriesisHorizontal
- true if orientation is horizontalprivate static void addPoint(java.util.List<java.lang.Integer> pointList, int x, int y, boolean isHorizontal)
private void drawArea(org.eclipse.swt.graphics.GC gc, int[] p, boolean isHorizontal)
gc
- the graphic contextp
- the line pointsisHorizontal
- true if orientation is horizontalprivate void drawSymbolAndLabel(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)
gc
- the graphics contextwidth
- the width to draw seriesheight
- the height to draw seriesxAxis
- the x axisyAxis
- the y axispublic void drawSeriesSymbol(org.eclipse.swt.graphics.GC gc, int h, int v, org.eclipse.swt.graphics.Color color)
gc
- the GC objecth
- the horizontal coordinate to draw symbolv
- the vertical coordinate to draw symbolcolor
- the symbol color