The Bubble Series Type
Bubble Chart is provided by the FastBubbleRenderableSeries class. It accepts data (X, Y, Z
) from a XyzDataSeries<TX,TY,TZ> and renders a bubble at each [X, Y]
with Z
bubble scale.
Note
For more info about XyzDataSeries<TX,TY,TZ>, as well as other DataSeries types in SciChart, see the DataSeries API article.
Note
Examples for the Bubble Series can be found in the SciChart Android Examples Suite as well as on GitHub:
The FastBubbleRenderableSeries class allows to specify BubbleBrush and Stroke via the following properties:
Note
To learn more about Pens and Brushes and how to utilize them, please refer to the PenStyle, BrushStyle and FontStyle article.
Also, you can control bubbles scaling using the following properties:
Note
In multi axis scenarios, a series has to be assigned to particular X and Y axes. This can be done passing the axes IDs to the xAxisId, yAxisId properties.
Create a Bubble Series
To create a Bubble Series, use the following code:
@Override
protected void initExample(@NonNull SciChartSurface surface) {
final IXyzDataSeries<Double, Double, Double> dataSeries = new XyzDataSeries<>(Double.class, Double.class, Double.class);
dataSeries.append(0.0, 0.0, 1.0);
dataSeries.append(1.0, 1.0, 3.0);
dataSeries.append(2.0, 4.0, 2.0);
final FastBubbleRenderableSeries bubbleSeries = new FastBubbleRenderableSeries();
bubbleSeries.setDataSeries(dataSeries);
bubbleSeries.setStrokeStyle(new SolidPenStyle(0xFFCCCCCC, true, 2f, null));
bubbleSeries.setBubbleBrushStyle(new SolidBrushStyle(0x77CCCCCC));
UpdateSuspender.using(surface, () -> {
Collections.addAll(surface.getXAxes(), new NumericAxis(requireContext()));
Collections.addAll(surface.getYAxes(), new NumericAxis(requireContext()));
Collections.addAll(surface.getRenderableSeries(), bubbleSeries);
});
}
Bubble Series Features
Bubble Series also has some features similar to other series, such as:
Render a Gap in a Bubble Series
It's possible to render a Gap in Bubble series, by passing a data point with a NaN
as the Y
value. Please refer to the RenderableSeries APIs article for more details.
Paint Bubbles with Different Colors
In SciChart, you can draw each bubble of the Bubble Series with different colors using the PaletteProvider API. To Use palette provider for Bubbles - a custom IFillPaletteProvider (or IStrokePaletteProvider) has to be provided to the paletteProvider property. Please refer to the PaletteProvider API article for more info.