public class DoughnutChart
- Object
- AbstractChart
- RoundChart
- DoughnutChart
Visualises a MultipleCategorySeries as concentric rings that share a
common centre (also known as a doughnut chart).
Each category in the dataset is drawn as a separate ring, making it suitable
for representing hierarchical proportions. Construct the chart with the
dataset and a DefaultRenderer and wrap it in a
com.codename1.charts.ChartComponent to place it on screen.
Constructors
public DoughnutChart(MultipleCategorySeries dataset, DefaultRenderer renderer) | Builds a new doughnut chart instance. |
Methods
public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint) | The graphical representation of the doughnut chart. |
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. |
Inherited fields
Inherited methods
From RoundChart
drawTitle, getRenderer, getCenterX, setCenterX, getCenterY, setCenterY, isAutocalculateCenter, setAutocalculateCenter
Constructor details
DoughnutChart
public DoughnutChart(MultipleCategorySeries dataset, DefaultRenderer renderer)Builds a new doughnut chart instance.
Parameters
datasetMultipleCategorySeries- the series dataset
rendererDefaultRenderer- the series renderer
Method details
draw
public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint)The graphical representation of the doughnut chart.
Parameters
canvasCanvas- the canvas to paint to
xint- the top left x value of the view to draw to
yint- the top left y value of the view to draw to
widthint- the width of the view to draw to
heightint- the height of the view to draw to
paintPaint- the paint
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