public class BubbleChart

  1. Object
  2. AbstractChart
  3. XYChart
  4. BubbleChart

Displays series of XYValueSeries entries as proportional bubbles on top of an XYChart plot.

Combine the chart with an XYMultipleSeriesDataset that contains one or more XYValueSeries instances and supply an XYMultipleSeriesRenderer. The resulting BubbleChart can be wrapped in a com.codename1.charts.ChartComponent to embed it inside a Codename One UI.

Fields

public static final String TYPE = "Bubble"The constant to identify this chart type.

Constructors

public BubbleChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Builds a new bubble chart instance.

Methods

public void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer renderer, float yAxisValue, int seriesIndex, int startIndex)The graphical representation of a series.
protected ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex)Returns the clickable areas for all passed points
public int getLegendShapeWidth(int seriesIndex)Returns the legend shape width.
public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint)The graphical representation of the legend shape.
public String getChartType()Returns the chart type identifier.

Inherited fields

Inherited methods

Field details

TYPE

public static final String TYPE = "Bubble"
The constant to identify this chart type.

Constructor details

BubbleChart

public BubbleChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)
Builds a new bubble chart instance.

Parameters

dataset XYMultipleSeriesDataset
the multiple series dataset
renderer XYMultipleSeriesRenderer
the multiple series renderer

Method details

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

canvas Canvas
the canvas to paint to
paint Paint
the paint to be used for drawing
points List<Float>
the array of points to be used for drawing the series
renderer XYSeriesRenderer
the series renderer
yAxisValue float
the minimum value of the y-axis
seriesIndex int
the index of the series currently being drawn
startIndex int
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

points List<Float>
the array of points
values List<Double>
the array of values of each point
yAxisValue float
the minimum value of the y axis
seriesIndex int
the index of the series to which the points belong
startIndex int
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

seriesIndex int
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

canvas Canvas
the canvas to paint to
renderer SimpleSeriesRenderer
the series renderer
x float
the x value of the point the shape should be drawn at
y float
the y value of the point the shape should be drawn at
seriesIndex int
the series index
paint Paint
the paint to be used for drawing

getChartType

public String getChartType()
Returns the chart type identifier.

Returns

the chart type