public class PieChart

  1. Object
  2. AbstractChart
  3. RoundChart
  4. 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

Constructor details

PieChart

public PieChart(CategorySeries dataset, DefaultRenderer renderer)
Builds a new pie chart instance.

Parameters

dataset CategorySeries
the series dataset
renderer DefaultRenderer
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

canvas Canvas
the canvas to paint to
x int
the top left x value of the view to draw to
y int
the top left y value of the view to draw to
width int
the width of the view to draw to
height int
the height of the view to draw to
paint Paint
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

pointIndex int
The point index representing the pie segment.

Returns

A shape of the outline of the segment.