public class ScatterChart
- Object
- AbstractChart
- XYChart
- ScatterChart
Renders discrete X/Y points without connecting lines.
Configure the marker style through XYSeriesRenderer#setPointStyle and
related options on the XYMultipleSeriesRenderer. As with other
charts, wrap the instance in a com.codename1.charts.ChartComponent to
place it on a form.
Fields
public static final String TYPE = "Scatter" | The constant to identify this chart type. |
Constructors
public ScatterChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) | Builds a new scatter 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, isRenderPoints, getDefaultMinimum, getPointsChart
Field details
TYPE
public static final String TYPE = "Scatter"The constant to identify this chart type.
Constructor details
ScatterChart
public ScatterChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Builds a new scatter chart instance.
Parameters
datasetXYMultipleSeriesDataset- the multiple series dataset
rendererXYMultipleSeriesRenderer- the multiple series renderer
Method details
setDatasetRenderer
protected void setDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer 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
getChartType
public String getChartType()Returns the chart type identifier.
Returns
the chart type