public class CubicLineChart

  1. Object
  2. AbstractChart
  3. XYChart
  4. LineChart
  5. CubicLineChart

Draws smooth curves through XY series values using cubic interpolation.

Use this chart when you want to emphasise the trend between points rather than the raw straight-line segments of LineChart. Supply the XYMultipleSeriesDataset and XYMultipleSeriesRenderer as usual and pass an optional smoothness factor to control how tightly the curve follows the provided data points.

Fields

public static final String TYPE = "Cubic"The chart type.

Constructors

public CubicLineChart()
public CubicLineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness)Builds a cubic line chart.

Methods

protected void drawPath(Canvas canvas, List<Float> points, Paint paint, boolean circular)The graphical representation of a path.
protected void drawPoints(Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)Draws the series points.
public String getChartType()Returns the chart type identifier.

Inherited fields

Inherited methods

Field details

TYPE

public static final String TYPE = "Cubic"
The chart type.

Constructor details

CubicLineChart

public CubicLineChart()

CubicLineChart

public CubicLineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness)
Builds a cubic line chart.

Parameters

dataset XYMultipleSeriesDataset
the dataset
renderer XYMultipleSeriesRenderer
the renderer
smoothness float
smoothness determines how smooth the curve should be, range [0->0.5] super smooth, 0.5, means that it might not get close to control points if you have random data // less smooth, (close to 0) means that it will most likely touch all control // points

Method details

drawPath

protected void drawPath(Canvas canvas, List<Float> points, Paint paint, boolean circular)
The graphical representation of a path.

Parameters

canvas Canvas
the canvas to paint to
points List<Float>
the points that are contained in the path to paint
paint Paint
the paint to be used for painting
circular boolean
if the path ends with the start point

drawPoints

protected void drawPoints(Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)
Draws the series points.

Parameters

canvas Canvas
the canvas
paint Paint
the paint object
pointsList List<Float>
the points to be rendered
seriesRenderer XYSeriesRenderer
the series renderer
yAxisValue float
the y axis value in pixels
seriesIndex int
the series index
startIndex int
the start index of the rendering points

getChartType

public String getChartType()
Returns the chart type identifier.

Returns

the chart type