public class PieChart
- Object
- AbstractChart
- RoundChart
- PieChart
Shows each value from a CategorySeries as a slice of a circle.
Combine this chart with a DefaultRenderer to control colours, labels
and gradients. The resulting PieChart can be embedded in a form via a
com.codename1.charts.ChartComponent.
Constructors
public PieChart(CategorySeries dataset, DefaultRenderer renderer) | Builds a new pie chart instance. |
Methods
public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint) | The graphical representation of the pie chart. |
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint) | Given screen coordinates, returns the series and point indexes of a chart element. |
public Shape getSegmentShape(int pointIndex) | Gets the shape of a pie segment given its point index. |
Inherited fields
Inherited methods
From RoundChart
drawTitle, getLegendShapeWidth, drawLegendShape, getRenderer, getCenterX, setCenterX, getCenterY, setCenterY, isAutocalculateCenter, setAutocalculateCenter
Constructor details
PieChart
public PieChart(CategorySeries dataset, DefaultRenderer renderer)Builds a new pie chart instance.
Parameters
datasetCategorySeries- 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 pie 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
getSeriesAndPointForScreenCoordinate
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint)Given screen coordinates, returns the series and point indexes of a chart
element. If there is no chart element (line, point, bar, etc) at those
coordinates, null is returned.
Returns
the series and point indexes
getSegmentShape
public Shape getSegmentShape(int pointIndex)Gets the shape of a pie segment given its point index.
Parameters
pointIndexint- The point index representing the pie segment.
Returns
A shape of the outline of the segment.