public abstract class XYChart
- Object
- AbstractChart
- XYChart
Known subtypesBarChart, BubbleChart, CombinedXYChart, LineChart, ScatterChart
The XY chart rendering class.
Fields
protected XYMultipleSeriesDataset mDataset | The multiple series dataset. |
protected XYMultipleSeriesRenderer mRenderer | The multiple series renderer. |
Constructors
protected XYChart() | |
public XYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer) | Builds a new XY chart instance. |
Methods
Inherited methods
Field details
mDataset
protected XYMultipleSeriesDataset mDatasetThe multiple series dataset.
mRenderer
protected XYMultipleSeriesRenderer mRendererThe multiple series renderer.
Constructor details
XYChart
protected XYChart()XYChart
public XYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)Builds a new XY chart instance.
Parameters
datasetXYMultipleSeriesDataset- the multiple series dataset
rendererXYMultipleSeriesRenderer- the multiple series renderer
Method details
setDatasetRenderer
protected void setDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)draw
public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint)The graphical representation of the XY chart.
Parameters
canvasCanvas- the canvas to paint to
xint- the top left x value of the view to draw to
yint- the top left y value of the view to draw to
widthint- the width of the view to draw to
heightint- the height of the view to draw to
paintPaint- the paint
getXLabels
protected List<Double> getXLabels(double min, double max, int count)getYLabels
protected Map<Integer, List<Double>> getYLabels(double[] minY, double[] maxY, int maxScaleNumber)getScreenR
protected Rectangle getScreenR()setScreenR
protected void setScreenR(Rectangle screenR)drawSeries
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, XYMultipleSeriesRenderer.Orientation or, int startIndex)Draws the series.
Parameters
seriesXYSeries- the series
canvasCanvas- the canvas
paintPaint- the paint object
pointsListList<Float>- the points to be rendered
seriesRendererXYSeriesRenderer- the series renderer
yAxisValuefloat- the y axis value in pixels
seriesIndexint- the series index
orXYMultipleSeriesRenderer.Orientation- the orientation
startIndexint- the start index of the rendering points
drawPoints
protected void drawPoints(Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)Draws the series points.
Parameters
canvasCanvas- the canvas
paintPaint- the paint object
pointsListList<Float>- the points to be rendered
seriesRendererXYSeriesRenderer- the series renderer
yAxisValuefloat- the y axis value in pixels
seriesIndexint- the series index
startIndexint- the start index of the rendering points
drawChartValuesText
protected void drawChartValuesText(Canvas canvas, XYSeries series, XYSeriesRenderer renderer, Paint paint, List<Float> points, int seriesIndex, int startIndex)The graphical representation of the series values as text.
Parameters
canvasCanvas- the canvas to paint to
seriesXYSeries- the series to be painted
rendererXYSeriesRenderer- the series renderer
paintPaint- the paint to be used for drawing
pointsList<Float>- the array of points to be used for drawing the series
seriesIndexint- the index of the series currently being drawn
startIndexint- the start index of the rendering points
drawText
protected void drawText(Canvas canvas, String text, float x, float y, Paint paint, float extraAngle)The graphical representation of a text, to handle both HORIZONTAL and
VERTICAL orientations and extra rotation angles.
Parameters
canvasCanvas- the canvas to paint to
textString- the text to be rendered
xfloat- the X axis location of the text
yfloat- the Y axis location of the text
paintPaint- the paint to be used for drawing
extraAnglefloat- the text angle
drawXLabels
protected void drawXLabels(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.
Parameters
xLabelsList<Double>- the X labels values
xTextLabelLocationsDouble[]- the X text label locations
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
leftint- the left value of the labels area
topint- the top value of the labels area
bottomint- the bottom value of the labels area
xPixelsPerUnitdouble- the amount of pixels per one unit in the chart labels
minXdouble- the minimum value on the X axis in the chart
maxXdouble- the maximum value on the X axis in the chart
drawYLabels
protected void drawYLabels(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.
Parameters
allYLabelsMap<Integer, List<Double>>- the Y labels values
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
maxScaleNumberint- the maximum scale number
leftint- the left value of the labels area
rightint- the right value of the labels area
bottomint- the bottom value of the labels area
yPixelsPerUnitdouble[]- the amount of pixels per one unit in the chart labels
minYdouble[]- the minimum value on the Y axis in the chart
drawXTextLabels
protected void drawXTextLabels(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.
Parameters
xTextLabelLocationsDouble[]- the X text label locations
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
showLabelsboolean- Not documented.
leftint- the left value of the labels area
topint- the top value of the labels area
bottomint- the bottom value of the labels area
xPixelsPerUnitdouble- the amount of pixels per one unit in the chart labels
minXdouble- the minimum value on the X axis in the chart
maxXdouble- the maximum value on the X axis in the chart
getRenderer
public XYMultipleSeriesRenderer getRenderer()getDataset
public XYMultipleSeriesDataset getDataset()getCalcRange
public double[] getCalcRange(int scale)setCalcRange
public void setCalcRange(double[] range, int scale)toRealPoint
public double[] toRealPoint(float screenX, float screenY)toScreenPoint
public double[] toScreenPoint(double[] realPoint)toRealPoint
public double[] toRealPoint(float screenX, float screenY, int scale)Transforms a screen point to a real coordinates point.
Parameters
screenXfloat- the screen x axis value
screenYfloat- the screen y axis value
scaleint- Not documented.
Returns
the real coordinates point
toScreenPoint
public double[] toScreenPoint(double[] realPoint, int scale)getSeriesAndPointForScreenCoordinate
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint)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.
Returns
the series and point indexes
drawSeries
public abstract void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)The graphical representation of a series.
Parameters
canvasCanvas- the canvas to paint to
paintPaint- the paint to be used for drawing
pointsList<Float>- the array of points to be used for drawing the series
seriesRendererXYSeriesRenderer- the series renderer
yAxisValuefloat- the minimum value of the y axis
seriesIndexint- the index of the series currently being drawn
startIndexint- the start index of the rendering points
clickableAreasForPoints
protected abstract ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex)Returns the clickable areas for all passed points
Parameters
pointsList<Float>- the array of points
valuesList<Double>- the array of values of each point
yAxisValuefloat- the minimum value of the y axis
seriesIndexint- the index of the series to which the points belong
startIndexint- the start index of the rendering points
Returns
an array of rectangles with the clickable area
isRenderNullValues
protected boolean isRenderNullValues()Returns if the chart should display the null values.
Returns
if null values should be rendered
isRenderPoints
public boolean isRenderPoints(SimpleSeriesRenderer renderer)Returns if the chart should display the points as a certain shape.
Parameters
rendererSimpleSeriesRenderer- the series renderer
getDefaultMinimum
public double getDefaultMinimum()Returns the default axis minimum.
Returns
the default axis minimum
getPointsChart
public ScatterChart getPointsChart()Returns the scatter chart to be used for drawing the data points.
Returns
the data points scatter chart
getChartType
public abstract String getChartType()Returns the chart type identifier.
Returns
the chart type