Search in sources :

Example 1 with XYValueSeries

use of com.codename1.charts.models.XYValueSeries in project CodenameOne by codenameone.

the class XYValueSeriesTransition method initTransition.

/**
 * Initializes the transition.  This can be overridden by subclasses to
 * provide their own functionality to be executed just before the transition
 * occurs.
 */
@Override
public void initTransition() {
    super.initTransition();
    // Now make sure that there are the same number of values in source and
    // target
    startVals = new XYValueSeries("Start");
    copyValues(series, startVals);
    endVals = new XYValueSeries("End");
    copyValues(cachedSeries, endVals);
}
Also used : XYValueSeries(com.codename1.charts.models.XYValueSeries)

Example 2 with XYValueSeries

use of com.codename1.charts.models.XYValueSeries in project CodenameOne by codenameone.

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(com.codename1.charts.compat.Paint) XYValueSeries(com.codename1.charts.models.XYValueSeries)

Example 3 with XYValueSeries

use of com.codename1.charts.models.XYValueSeries in project CodenameOne by codenameone.

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(PkgUtils.makeRect(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 : Paint(com.codename1.charts.compat.Paint) XYValueSeries(com.codename1.charts.models.XYValueSeries)

Aggregations

XYValueSeries (com.codename1.charts.models.XYValueSeries)3 Paint (com.codename1.charts.compat.Paint)2