Class LineChart

Direct Known Subclasses:
CubicLineChart, TimeChart

public class LineChart extends XYChart

Plots series of X/Y points using straight line segments.

Supply the chart with an XYMultipleSeriesDataset and configure its appearance via an XYMultipleSeriesRenderer. The chart is commonly wrapped in a com.codename1.charts.ChartComponent before being added to a Codename One form.

  • Field Details

  • Constructor Details

  • Method Details

    • setDatasetRenderer

      protected void setDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)

      Sets the series and the renderer.

      Parameters
      • dataset: the series dataset

      • renderer: the series renderer

      Overrides:
      setDatasetRenderer in class XYChart
    • drawSeries

      public void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer renderer, float yAxisValue, int seriesIndex, int startIndex)

      The graphical representation of a series.

      Parameters
      • canvas: the canvas to paint to

      • paint: the paint to be used for drawing

      • points: the array of points to be used for drawing the series

      • seriesRenderer: the series renderer

      • yAxisValue: the minimum value of the y axis

      • seriesIndex: the index of the series currently being drawn

      • startIndex: the start index of the rendering points

      Specified by:
      drawSeries in class XYChart
    • clickableAreasForPoints

      protected ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex)
      Description copied from class: XYChart

      Returns the clickable areas for all passed points

      Parameters
      • points: the array of points

      • values: the array of values of each point

      • yAxisValue: the minimum value of the y axis

      • seriesIndex: the index of the series to which the points belong

      • startIndex: the start index of the rendering points

      Returns

      an array of rectangles with the clickable area

      Specified by:
      clickableAreasForPoints in class XYChart
    • 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
    • isRenderPoints

      public boolean isRenderPoints(SimpleSeriesRenderer renderer)

      Returns if the chart should display the points as a certain shape.

      Parameters
      • renderer: the series renderer
      Overrides:
      isRenderPoints in class XYChart
    • getPointsChart

      public ScatterChart getPointsChart()

      Returns the scatter chart to be used for drawing the data points.

      Returns

      the data points scatter chart

      Overrides:
      getPointsChart in class XYChart
    • getChartType

      public String getChartType()

      Returns the chart type identifier.

      Returns

      the chart type

      Specified by:
      getChartType in class XYChart