Search in sources :

Example 1 with XYValueSeries

use of org.achartengine.model.XYValueSeries in project sensorreadout by onyxbits.

the class BubbleChart 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
   */
@Override
public void drawSeries(Canvas canvas, Paint paint, List<Float> points, XYSeriesRenderer renderer, float yAxisValue, int seriesIndex, int startIndex) {
    paint.setColor(renderer.getColor());
    paint.setStyle(Style.FILL);
    int length = points.size();
    XYValueSeries series = (XYValueSeries) mDataset.getSeriesAt(seriesIndex);
    double max = series.getMaxValue();
    double coef = MAX_BUBBLE_SIZE / max;
    for (int i = 0; i < length; i += 2) {
        double size = series.getValue(startIndex + i / 2) * coef + MIN_BUBBLE_SIZE;
        drawCircle(canvas, paint, points.get(i), points.get(i + 1), (float) size);
    }
}
Also used : Paint(android.graphics.Paint) XYValueSeries(org.achartengine.model.XYValueSeries)

Example 2 with XYValueSeries

use of org.achartengine.model.XYValueSeries in project sensorreadout by onyxbits.

the class BubbleChart method clickableAreasForPoints.

@Override
protected ClickableArea[] clickableAreasForPoints(List<Float> points, List<Double> values, float yAxisValue, int seriesIndex, int startIndex) {
    int length = points.size();
    XYValueSeries series = (XYValueSeries) mDataset.getSeriesAt(seriesIndex);
    double max = series.getMaxValue();
    double coef = MAX_BUBBLE_SIZE / max;
    ClickableArea[] ret = new ClickableArea[length / 2];
    for (int i = 0; i < length; i += 2) {
        double size = series.getValue(startIndex + i / 2) * coef + MIN_BUBBLE_SIZE;
        ret[i / 2] = new ClickableArea(new RectF(points.get(i) - (float) size, points.get(i + 1) - (float) size, points.get(i) + (float) size, points.get(i + 1) + (float) size), values.get(i), values.get(i + 1));
    }
    return ret;
}
Also used : RectF(android.graphics.RectF) Paint(android.graphics.Paint) XYValueSeries(org.achartengine.model.XYValueSeries)

Example 3 with XYValueSeries

use of org.achartengine.model.XYValueSeries in project Anki-Android by Ramblurr.

the class BubbleChart method clickableAreasForPoints.

@Override
protected ClickableArea[] clickableAreasForPoints(float[] points, double[] values, float yAxisValue, int seriesIndex, int startIndex, int range) {
    int length = points.length;
    XYValueSeries series = (XYValueSeries) mDataset.getSeriesAt(seriesIndex);
    double max = series.getMaxValue();
    double coef = MAX_BUBBLE_SIZE / max;
    ClickableArea[] ret = new ClickableArea[length / 2];
    for (int i = 0; i < length; i += 2) {
        double size = series.getValue(startIndex + i / 2) * coef + MIN_BUBBLE_SIZE;
        ret[i / 2] = new ClickableArea(new RectF(points[i] - (float) size, points[i + 1] - (float) size, points[i] + (float) size, points[i + 1] + (float) size), values[i], values[i + 1]);
    }
    return ret;
}
Also used : RectF(android.graphics.RectF) Paint(android.graphics.Paint) XYValueSeries(org.achartengine.model.XYValueSeries)

Example 4 with XYValueSeries

use of org.achartengine.model.XYValueSeries in project Anki-Android by Ramblurr.

the class BubbleChart 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());
    paint.setStyle(Style.FILL);
    int length = points.length;
    XYValueSeries series = (XYValueSeries) mDataset.getSeriesAt(seriesIndex);
    double max = series.getMaxValue();
    double coef = MAX_BUBBLE_SIZE / max;
    for (int i = 0; i < length; i += 2) {
        double size = series.getValue(startIndex + i / 2) * coef + MIN_BUBBLE_SIZE;
        drawCircle(canvas, paint, points[i], points[i + 1], (float) size);
    }
}
Also used : XYSeriesRenderer(org.achartengine.renderer.XYSeriesRenderer) Paint(android.graphics.Paint) XYValueSeries(org.achartengine.model.XYValueSeries)

Aggregations

Paint (android.graphics.Paint)4 XYValueSeries (org.achartengine.model.XYValueSeries)4 RectF (android.graphics.RectF)2 XYSeriesRenderer (org.achartengine.renderer.XYSeriesRenderer)1