class BubbleRenderer extends XYSeriesRenderer<BubbleSeries, FormatterType> {

    @Override
    protected void onRender(Canvas canvas, RectF plotArea, BubbleSeries series,
            FormatterType formatter, RenderStack stack) {

        Region magnitudeBounds = calculateBounds();
        for(int i = 0; i < series.size(); i++) {

            // only render non-null values greater than zero:
            if(series.getY(i) != null && series.getZ(i).doubleValue() > 0) {

                final PointF centerPoint = getPlot().getBounds().
                        transform(series.getX(i), series.getY(i), plotArea, false, true);

                // calculate bubble radius:
                float bubbleRadius = magnitudeBounds.
                        transform(bubbleScaleMode == BubbleScaleMode.SQUARE_ROOT ?
                                  Math.sqrt(series.getZ(i).doubleValue()) :
                                  series.getZ(i).doubleValue(), bubbleBounds).floatValue();
                drawBubble(canvas, formatter, series, i, centerPoint, bubbleRadius);
            }
        }
    }

    public  BubbleRenderer(XYPlot plot);

}