Class 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.
-
Field Summary
FieldsFields inherited from class XYChart
mDataset, mRendererModifier and TypeFieldDescriptionprotected XYMultipleSeriesDatasetThe multiple series dataset.protected XYMultipleSeriesRendererThe multiple series renderer. -
Constructor Summary
ConstructorsConstructorDescriptionCubicLineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness) Builds a cubic line chart. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThe graphical representation of a path.protected voiddrawPoints(Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) Draws the series points.Returns the chart type identifier.Methods inherited from class LineChart
clickableAreasForPoints, drawLegendShape, drawSeries, getLegendShapeWidth, getPointsChart, isRenderPoints, setDatasetRendererModifier and TypeMethodDescriptionprotected ClickableArea[]clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex) Returns the clickable areas for all passed pointsvoiddrawLegendShape(Canvas canvas, SimpleSeriesRenderer renderer, float x, float y, int seriesIndex, Paint paint) The graphical representation of the legend shape.voiddrawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer renderer, float yAxisValue, int seriesIndex, int startIndex) The graphical representation of a series.intgetLegendShapeWidth(int seriesIndex) Returns the legend shape width.Returns the scatter chart to be used for drawing the data points.booleanisRenderPoints(SimpleSeriesRenderer renderer) Returns if the chart should display the points as a certain shape.protected voidsetDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) Sets the series and the renderer.Methods inherited from class XYChart
draw, drawChartValuesText, drawSeries, drawText, drawXLabels, drawXTextLabels, drawYLabels, getCalcRange, getDataset, getDefaultMinimum, getRenderer, getScreenR, getSeriesAndPointForScreenCoordinate, getXLabels, getYLabels, isRenderNullValues, setCalcRange, setScreenR, toRealPoint, toRealPoint, toScreenPoint, toScreenPointModifier and TypeMethodDescriptionvoidThe graphical representation of the XY chart.protected voiddrawChartValuesText(Canvas canvas, XYSeries series, XYSeriesRenderer renderer, Paint paint, List<Float> points, int seriesIndex, int startIndex) The graphical representation of the series values as text.protected voiddrawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, XYMultipleSeriesRenderer.Orientation or, int startIndex) Draws the series.protected voidThe graphical representation of a text, to handle both HORIZONTAL and VERTICAL orientations and extra rotation angles.protected voiddrawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX) The graphical representation of the labels on the X axis.protected voiddrawXTextLabels(Double[] xTextLabelLocations, Canvas canvas, Paint paint, boolean showLabels, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX) The graphical representation of the text labels on the X axis.protected voiddrawYLabels(Map<Integer, List<Double>> allYLabels, Canvas canvas, Paint paint, int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY) The graphical representation of the labels on the Y axis.double[]getCalcRange(int scale) doubleReturns the default axis minimum.protected RectanglegetSeriesAndPointForScreenCoordinate(Point screenPoint) Given screen coordinates, returns the series and point indexes of a chart element.getXLabels(double min, double max, int count) getYLabels(double[] minY, double[] maxY, int maxScaleNumber) protected booleanReturns if the chart should display the null values.voidsetCalcRange(double[] range, int scale) protected voidsetScreenR(Rectangle screenR) double[]toRealPoint(float screenX, float screenY) double[]toRealPoint(float screenX, float screenY, int scale) Transforms a screen point to a real coordinates point.double[]toScreenPoint(double[] realPoint) double[]toScreenPoint(double[] realPoint, int scale) Methods inherited from class AbstractChart
calculateDrawPoints, drawBackground, drawLabel, drawLegend, drawPath, drawString, getExceed, getLabel, getLegendSize, isNullValue, isVerticalModifier and TypeMethodDescriptionprotected static float[]calculateDrawPoints(float p1x, float p1y, float p2x, float p2y, int screenHeight, int screenWidth) protected voiddrawBackground(DefaultRenderer renderer, Canvas canvas, int x, int y, int width, int height, Paint paint, boolean newColor, int color) Draws the chart background.protected voiddrawLabel(Canvas canvas, String labelText, DefaultRenderer renderer, List<Rectangle2D> prevLabelsBounds, int centerX, int centerY, float shortRadius, float longRadius, float currentAngle, float angle, int left, int right, int color, Paint paint, boolean line, boolean display) Draws a text label.protected intdrawLegend(Canvas canvas, DefaultRenderer renderer, String[] titles, int left, int right, int y, int width, int height, int legendSize, Paint paint, boolean calculate) Draws the chart legend.protected voidThe graphical representation of a path.protected voiddrawString(Canvas canvas, String text, float x, float y, Paint paint) Draw a multiple lines string.protected booleangetExceed(float currentWidth, DefaultRenderer renderer, int right, int width) Calculates if the current width exceeds the total width.protected StringgetLabel(NumberFormat format, double label) Makes sure the fraction digit is not displayed, if not needed.protected intgetLegendSize(DefaultRenderer renderer, int defaultHeight, float extraHeight) Calculates the current legend size.booleanisNullValue(double value) booleanisVertical(DefaultRenderer renderer) Checks if the current chart is rendered as vertical.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Field Details
-
TYPE
-
-
Constructor Details
-
CubicLineChart
public CubicLineChart() -
CubicLineChart
public CubicLineChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer, float smoothness) Builds a cubic line chart.
Parameters
-
dataset: the dataset -
renderer: the renderer -
smoothness: @param smoothness 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
Description copied from class:AbstractChartThe graphical representation of a path.
Parameters
-
canvas: the canvas to paint to -
points: the points that are contained in the path to paint -
paint: the paint to be used for painting -
circular: if the path ends with the start point
- Overrides:
drawPathin classAbstractChart
-
-
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: the canvas -
paint: the paint object -
pointsList: the points to be rendered -
seriesRenderer: the series renderer -
yAxisValue: the y axis value in pixels -
seriesIndex: the series index -
startIndex: the start index of the rendering points
- Overrides:
drawPointsin classXYChart
-
-
getChartType
Returns the chart type identifier.
Returns
the chart type
- Overrides:
getChartTypein classLineChart
-