public class LineChart
- Object
- AbstractChart
- XYChart
- LineChart
Known subtypesCubicLineChart, TimeChart
Plots series of X/Y points using straight line segments.
Supply the chart with an XYMultipleSeriesDataset and configure its
appearance via an XYMultipleSeriesRenderer. The chart is commonly
wrapped in a com.codename1.charts.ChartComponent before being added
to a Codename One form.
Fields
public static final String TYPE = "Line" | The constant to identify this chart type. |
Constructors
public LineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) | Builds a new line chart instance. |
Methods
Inherited fields
Inherited methods
From XYChart
draw, getXLabels, getYLabels, getScreenR, setScreenR, drawSeries, drawPoints, drawChartValuesText, drawText, drawXLabels, drawYLabels, drawXTextLabels, getRenderer, getDataset, getCalcRange, setCalcRange, toRealPoint, toScreenPoint, toRealPoint, toScreenPoint, getSeriesAndPointForScreenCoordinate, isRenderNullValues, getDefaultMinimum
Field details
TYPE
public static final String TYPE = "Line"The constant to identify this chart type.
Constructor details
LineChart
public LineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Builds a new line chart instance.
Parameters
datasetXYMultipleSeriesDataset- the multiple series dataset
rendererXYMultipleSeriesRenderer- the multiple series renderer
Method details
setDatasetRenderer
protected void setDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Sets the series and the renderer.
Parameters
datasetXYMultipleSeriesDataset- the series dataset
rendererXYMultipleSeriesRenderer- the series renderer
drawSeries
public void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer renderer, float yAxisValue, int seriesIndex, int startIndex)The graphical representation of a series.
Parameters
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
pointsList<Float>- the array of points to be used for drawing the series
rendererXYSeriesRenderer- the series renderer
yAxisValuefloat- the minimum value of the y axis
seriesIndexint- the index of the series currently being drawn
startIndexint- the start index of the rendering points
clickableAreasForPoints
protected ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex)Returns the clickable areas for all passed points
Parameters
pointsList<Float>- the array of points
valuesList<Double>- the array of values of each point
yAxisValuefloat- the minimum value of the y axis
seriesIndexint- the index of the series to which the points belong
startIndexint- the start index of the rendering points
Returns
an array of rectangles with the clickable area
getLegendShapeWidth
public int getLegendShapeWidth(int seriesIndex)Returns the legend shape width.
Parameters
seriesIndexint- the series index
Returns
the legend shape width
drawLegendShape
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint)The graphical representation of the legend shape.
Parameters
canvasCanvas- the canvas to paint to
rendererSimpleSeriesRenderer- the series renderer
xfloat- the x value of the point the shape should be drawn at
yfloat- the y value of the point the shape should be drawn at
seriesIndexint- the series index
paintPaint- the paint to be used for drawing
isRenderPoints
public boolean isRenderPoints(SimpleSeriesRenderer renderer)Returns if the chart should display the points as a certain shape.
Parameters
rendererSimpleSeriesRenderer- the series renderer
getPointsChart
public ScatterChart getPointsChart()Returns the scatter chart to be used for drawing the data points.
Returns
the data points scatter chart
getChartType
public String getChartType()Returns the chart type identifier.
Returns
the chart type