public abstract class XYChart extends AbstractChart
Modifier and Type | Field and Description |
---|---|
protected XYMultipleSeriesDataset |
mDataset
The multiple series dataset.
|
protected XYMultipleSeriesRenderer |
mRenderer
The multiple series renderer.
|
Modifier | Constructor and Description |
---|---|
protected |
XYChart() |
|
XYChart(XYMultipleSeriesDataset dataset,
XYMultipleSeriesRenderer renderer)
Builds a new XY chart instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ClickableArea[] |
clickableAreasForPoints(List<Float> points,
List<Double> values,
float yAxisValue,
int seriesIndex,
int startIndex)
Returns the clickable areas for all passed points
|
void |
draw(Canvas canvas,
int x,
int y,
int width,
int height,
Paint paint)
The graphical representation of the XY chart.
|
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.
|
protected void |
drawPoints(Canvas canvas,
Paint paint,
List<Float> pointsList,
XYSeriesRenderer seriesRenderer,
float yAxisValue,
int seriesIndex,
int startIndex)
Draws the series points.
|
abstract void |
drawSeries(Canvas canvas,
Paint paint,
List<Float> points,
XYSeriesRenderer seriesRenderer,
float yAxisValue,
int seriesIndex,
int startIndex)
The graphical representation of a series.
|
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.
|
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.
|
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.
|
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.
|
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.
|
double[] |
getCalcRange(int scale) |
abstract String |
getChartType()
Returns the chart type identifier.
|
XYMultipleSeriesDataset |
getDataset() |
double |
getDefaultMinimum()
Returns the default axis minimum.
|
ScatterChart |
getPointsChart()
Returns the scatter chart to be used for drawing the data points.
|
XYMultipleSeriesRenderer |
getRenderer() |
protected Rectangle |
getScreenR() |
SeriesSelection |
getSeriesAndPointForScreenCoordinate(Point screenPoint)
Given screen coordinates, returns the series and point indexes of a chart
element.
|
protected List<Double> |
getXLabels(double min,
double max,
int count) |
protected Map<Integer,List<Double>> |
getYLabels(double[] minY,
double[] maxY,
int maxScaleNumber) |
protected boolean |
isRenderNullValues()
Returns if the chart should display the null values.
|
boolean |
isRenderPoints(SimpleSeriesRenderer renderer)
Returns if the chart should display the points as a certain shape.
|
void |
setCalcRange(double[] range,
int scale) |
protected void |
setDatasetRenderer(XYMultipleSeriesDataset dataset,
XYMultipleSeriesRenderer renderer) |
protected void |
setScreenR(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) |
drawBackground, drawLabel, drawLegend, drawLegendShape, drawPath, drawPath, drawString, getExceed, getLabel, getLegendShapeWidth, getLegendSize, isNullValue, isVertical
protected XYMultipleSeriesDataset mDataset
protected XYMultipleSeriesRenderer mRenderer
protected XYChart()
public XYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)
dataset
- the multiple series datasetrenderer
- the multiple series rendererprotected void setDatasetRenderer(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer renderer)
public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint)
draw
in class AbstractChart
canvas
- the canvas to paint tox
- the top left x value of the view to draw toy
- the top left y value of the view to draw towidth
- the width of the view to draw toheight
- the height of the view to draw topaint
- the paintprotected Map<Integer,List<Double>> getYLabels(double[] minY, double[] maxY, int maxScaleNumber)
protected Rectangle getScreenR()
protected void setScreenR(Rectangle screenR)
protected void drawSeries(XYSeries series, Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, XYMultipleSeriesRenderer.Orientation or, int startIndex)
series
- the seriescanvas
- the canvaspaint
- the paint objectpointsList
- the points to be renderedseriesRenderer
- the series rendereryAxisValue
- the y axis value in pixelsseriesIndex
- the series indexor
- the orientationstartIndex
- the start index of the rendering pointsprotected void drawPoints(Canvas canvas, Paint paint, List<Float> pointsList, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)
canvas
- the canvaspaint
- the paint objectpointsList
- the points to be renderedseriesRenderer
- the series rendereryAxisValue
- the y axis value in pixelsseriesIndex
- the series indexstartIndex
- the start index of the rendering pointsprotected void drawChartValuesText(Canvas canvas, XYSeries series, XYSeriesRenderer renderer, Paint paint, List<Float> points, int seriesIndex, int startIndex)
canvas
- the canvas to paint toseries
- the series to be paintedrenderer
- the series rendererpaint
- the paint to be used for drawingpoints
- the array of points to be used for drawing the seriesseriesIndex
- the index of the series currently being drawnstartIndex
- the start index of the rendering pointsprotected void drawText(Canvas canvas, String text, float x, float y, Paint paint, float extraAngle)
canvas
- the canvas to paint totext
- the text to be renderedx
- the X axis location of the texty
- the Y axis location of the textpaint
- the paint to be used for drawingextraAngle
- the text angleprotected void drawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX)
xLabels
- the X labels valuesxTextLabelLocations
- the X text label locationscanvas
- the canvas to paint topaint
- the paint to be used for drawingleft
- the left value of the labels areatop
- the top value of the labels areabottom
- the bottom value of the labels areaxPixelsPerUnit
- the amount of pixels per one unit in the chart labelsminX
- the minimum value on the X axis in the chartmaxX
- the maximum value on the X axis in the chartprotected void drawYLabels(Map<Integer,List<Double>> allYLabels, Canvas canvas, Paint paint, int maxScaleNumber, int left, int right, int bottom, double[] yPixelsPerUnit, double[] minY)
allYLabels
- the Y labels valuescanvas
- the canvas to paint topaint
- the paint to be used for drawingmaxScaleNumber
- the maximum scale numberleft
- the left value of the labels arearight
- the right value of the labels areabottom
- the bottom value of the labels areayPixelsPerUnit
- the amount of pixels per one unit in the chart labelsminY
- the minimum value on the Y axis in the chartprotected void drawXTextLabels(Double[] xTextLabelLocations, Canvas canvas, Paint paint, boolean showLabels, int left, int top, int bottom, double xPixelsPerUnit, double minX, double maxX)
xTextLabelLocations
- the X text label locationscanvas
- the canvas to paint topaint
- the paint to be used for drawingleft
- the left value of the labels areatop
- the top value of the labels areabottom
- the bottom value of the labels areaxPixelsPerUnit
- the amount of pixels per one unit in the chart labelsminX
- the minimum value on the X axis in the chartmaxX
- the maximum value on the X axis in the chartpublic XYMultipleSeriesRenderer getRenderer()
public XYMultipleSeriesDataset getDataset()
public double[] getCalcRange(int scale)
public void setCalcRange(double[] range, int scale)
public double[] toRealPoint(float screenX, float screenY)
public double[] toScreenPoint(double[] realPoint)
public double[] toRealPoint(float screenX, float screenY, int scale)
screenX
- the screen x axis valuescreenY
- the screen y axis valuepublic double[] toScreenPoint(double[] realPoint, int scale)
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint)
AbstractChart
getSeriesAndPointForScreenCoordinate
in class AbstractChart
public abstract void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex)
canvas
- the canvas to paint topaint
- the paint to be used for drawingpoints
- the array of points to be used for drawing the seriesseriesRenderer
- the series rendereryAxisValue
- the minimum value of the y axisseriesIndex
- the index of the series currently being drawnstartIndex
- the start index of the rendering pointsprotected abstract ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex)
points
- the array of pointsvalues
- the array of values of each pointyAxisValue
- the minimum value of the y axisseriesIndex
- the index of the series to which the points belongstartIndex
- the start index of the rendering pointsprotected boolean isRenderNullValues()
public boolean isRenderPoints(SimpleSeriesRenderer renderer)
renderer
- the series rendererpublic double getDefaultMinimum()
public ScatterChart getPointsChart()
public abstract String getChartType()