use of org.achartengine.renderer.XYSeriesRenderer in project Anki-Android by Ramblurr.
the class ScatterChart method drawSeries.
/**
* The graphical representation of a series.
*
* @param canvas the canvas to paint to
* @param paint the paint to be used for drawing
* @param points the array of points to be used for drawing the series
* @param seriesRenderer the series renderer
* @param yAxisValue the minimum value of the y axis
* @param seriesIndex the index of the series currently being drawn
* @param startIndex the start index of the rendering points
*/
public void drawSeries(Canvas canvas, Paint paint, float[] points, SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex, int range) {
XYSeriesRenderer renderer = (XYSeriesRenderer) seriesRenderer;
paint.setColor(renderer.getColor());
if (renderer.isFillPoints()) {
paint.setStyle(Style.FILL);
} else {
paint.setStyle(Style.STROKE);
}
int length = points.length;
switch(renderer.getPointStyle()) {
case X:
for (int i = 0; i < length; i += 2) {
drawX(canvas, paint, points[i], points[i + 1]);
}
break;
case CIRCLE:
for (int i = 0; i < length; i += 2) {
drawCircle(canvas, paint, points[i], points[i + 1]);
}
break;
case TRIANGLE:
float[] path = new float[6];
for (int i = 0; i < length; i += 2) {
drawTriangle(canvas, paint, path, points[i], points[i + 1]);
}
break;
case SQUARE:
for (int i = 0; i < length; i += 2) {
drawSquare(canvas, paint, points[i], points[i + 1]);
}
break;
case DIAMOND:
path = new float[8];
for (int i = 0; i < length; i += 2) {
drawDiamond(canvas, paint, path, points[i], points[i + 1]);
}
break;
case POINT:
canvas.drawPoints(points, paint);
break;
}
}
Aggregations