Class RoundChart

java.lang.Object
com.codename1.charts.views.AbstractChart
com.codename1.charts.views.RoundChart
Direct Known Subclasses:
DialChart, DoughnutChart, PieChart, RadarChart

public abstract class RoundChart extends AbstractChart

Base class for charts that render circular data representations such as pie charts, doughnut charts or gauges.

Subclasses operate on CategorySeries data and share common functionality for drawing the chart title, legend entries and handling layout. Developers typically work with concrete subclasses such as PieChart or DoughnutChart directly.

  • Field Details

    • SHAPE_WIDTH

      protected static final int SHAPE_WIDTH
      The legend shape width.
      See Also:
    • NO_VALUE

      protected static final int NO_VALUE
      A no value constant.
      See Also:
    • mDataset

      protected CategorySeries mDataset
      The series dataset.
    • mRenderer

      protected DefaultRenderer mRenderer
      The series renderer.
    • mCenterX

      protected int mCenterX
      The chart center X axis.
    • mCenterY

      protected int mCenterY
      The chart center y axis.
    • autoCalculateCenter

      protected boolean autoCalculateCenter
  • Constructor Details

    • RoundChart

      public RoundChart(CategorySeries dataset, DefaultRenderer renderer)

      Round chart.

      Parameters
      • dataset: the series dataset

      • renderer: the series renderer

  • Method Details

    • drawTitle

      public void drawTitle(Canvas canvas, int x, int y, int width, Paint paint)

      The graphical representation of the round chart title.

      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

      • paint: the paint

    • getLegendShapeWidth

      public int getLegendShapeWidth(int seriesIndex)

      Returns the legend shape width.

      Parameters
      • seriesIndex: the series index
      Returns

      the legend shape width

      Specified by:
      getLegendShapeWidth in class AbstractChart
    • 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: the canvas to paint to

      • renderer: the series renderer

      • x: the x value of the point the shape should be drawn at

      • y: the y value of the point the shape should be drawn at

      • seriesIndex: the series index

      • paint: the paint to be used for drawing

      Specified by:
      drawLegendShape in class AbstractChart
    • getRenderer

      public DefaultRenderer getRenderer()

      Returns the renderer.

      Returns

      the renderer

    • getCenterX

      public int getCenterX()

      Returns the center on X axis.

      Returns

      the center on X axis

    • setCenterX

      public void setCenterX(int centerX)

      Sets a new center on X axis.

      Parameters
      • centerX: center on X axis
    • getCenterY

      public int getCenterY()

      Returns the center on Y axis.

      Returns

      the center on Y axis

    • setCenterY

      public void setCenterY(int centerY)

      Sets a new center on Y axis.

      Parameters
      • centerY: center on Y axis
    • isAutocalculateCenter

      public boolean isAutocalculateCenter()
    • setAutocalculateCenter

      public void setAutocalculateCenter(boolean a)