Class CombinedXYChart
Aggregates multiple XYChart implementations into a single plot so
different series can be visualised using different renderers (for example a
line overlaid on top of a bar chart).
Provide the constructor with an XYMultipleSeriesDataset, a matching
XYMultipleSeriesRenderer and an array of
XYCombinedChartDef instances that describe which inner chart type
should render each data series. The combined chart can then be wrapped in a
com.codename1.charts.ChartComponent for display.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefinition of a chart inside a combined XY chart. -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedXYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, CombinedXYChart.XYCombinedChartDef[] chartDefinitions) Builds a new combined XY chart instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClickableArea[]clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex) Returns the clickable areas for all passed pointsvoiddrawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint) The graphical representation of the legend shape.voiddrawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) The graphical representation of a series.protected voiddrawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, XYMultipleSeriesRenderer.Orientation or, int startIndex) Draws the series.Returns the chart type identifier.intgetLegendShapeWidth(int seriesIndex) Returns the legend shape width.Methods inherited from class XYChart
draw, drawChartValuesText, drawPoints, drawText, drawXLabels, drawXTextLabels, drawYLabels, getCalcRange, getDataset, getDefaultMinimum, getPointsChart, getRenderer, getScreenR, getSeriesAndPointForScreenCoordinate, getXLabels, getYLabels, isRenderNullValues, isRenderPoints, setCalcRange, setDatasetRenderer, setScreenR, toRealPoint, toRealPoint, toScreenPoint, toScreenPointMethods inherited from class AbstractChart
calculateDrawPoints, drawBackground, drawLabel, drawLegend, drawPath, drawPath, drawString, getExceed, getLabel, getLegendSize, isNullValue, isVertical
-
Constructor Details
-
CombinedXYChart
public CombinedXYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, CombinedXYChart.XYCombinedChartDef[] chartDefinitions) Builds a new combined XY chart instance.
Parameters
-
dataset: the multiple series dataset -
renderer: the multiple series renderer -
chartDefinitions: the XY chart definitions
-
-
-
Method Details
-
drawSeries
public void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) The graphical representation of a series.
Parameters
-
canvas: the canvas to paint to -
paint: the paint to be used for drawing -
points: the array of points to be used for drawing the series -
seriesRenderer: the series renderer -
yAxisValue: the minimum value of the y axis -
seriesIndex: the index of the series currently being drawn -
startIndex: the start index of the rendering points
- Specified by:
drawSeriesin classXYChart
-
-
clickableAreasForPoints
protected ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex) Description copied from class:XYChartReturns the clickable areas for all passed points
Parameters
-
points: the array of points -
values: the array of values of each point -
yAxisValue: the minimum value of the y axis -
seriesIndex: the index of the series to which the points belong -
startIndex: the start index of the rendering points
Returns
an array of rectangles with the clickable area
- Specified by:
clickableAreasForPointsin classXYChart
-
-
drawSeries
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, XYMultipleSeriesRenderer.Orientation or, int startIndex) Description copied from class:XYChartDraws the series.
Parameters
-
series: the series -
canvas: the canvas -
paint: the paint object -
pointsList: the points to be rendered -
seriesRenderer: the series renderer -
yAxisValue: the y axis value in pixels -
seriesIndex: the series index -
or: the orientation -
startIndex: the start index of the rendering points
- Overrides:
drawSeriesin classXYChart
-
-
getLegendShapeWidth
public int getLegendShapeWidth(int seriesIndex) Returns the legend shape width.
Parameters
seriesIndex: the series index
Returns
the legend shape width
- Specified by:
getLegendShapeWidthin classAbstractChart
-
drawLegendShape
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint) The graphical representation of the legend shape.
Parameters
-
canvas: the canvas to paint to -
renderer: the series renderer -
x: the x value of the point the shape should be drawn at -
y: the y value of the point the shape should be drawn at -
seriesIndex: the series index -
paint: the paint to be used for drawing
- Specified by:
drawLegendShapein classAbstractChart
-
-
getChartType
Returns the chart type identifier.
Returns
the chart type
- Specified by:
getChartTypein classXYChart
-