Class PieChart


public class PieChart extends RoundChart

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.

  • Constructor Details

    • PieChart

      public PieChart(CategorySeries dataset, DefaultRenderer renderer)

      Builds a new pie chart instance.

      Parameters
      • dataset: the series dataset

      • renderer: 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: the canvas to paint to

      • x: the top left x value of the view to draw to

      • y: the top left y value of the view to draw to

      • width: the width of the view to draw to

      • height: the height of the view to draw to

      • paint: the paint

      Specified by:
      draw in class AbstractChart
    • getSeriesAndPointForScreenCoordinate

      public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint)
      Description copied from class: AbstractChart

      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.

      Parameters
      • screenPoint
      Returns

      the series and point indexes

      Overrides:
      getSeriesAndPointForScreenCoordinate in class AbstractChart
    • getSegmentShape

      public Shape getSegmentShape(int pointIndex)

      Gets the shape of a pie segment given its point index.

      Parameters
      • pointIndex: The point index representing the pie segment.
      Returns

      A shape of the outline of the segment.