Search Results for

    Show / Hide Table of Contents

    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.

    Bubble Series Type

    Note

    Examples for the Bubble Series can be found in the SciChart Android Examples Suite as well as on GitHub:

    • Native Example
    • Xamarin Example

    The FastBubbleRenderableSeries class allows to specify BubbleBrush and Stroke via the following properties:

    • bubbleBrushStyle
    • strokeStyle
    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:

    • zScaleFactor
    • autoZRange
    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:

    • Java
    • Java with Builders API
    • Kotlin
    @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);
        });
    }
    
    @Override
    protected void initExample(@NonNull SciChartSurface surface) {
        final IXyzDataSeries<Double, Double, Double> dataSeries = sciChartBuilder.newXyzDataSeries(Double.class, Double.class, Double.class).build();
        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 = sciChartBuilder.newBubbleSeries()
                .withDataSeries(dataSeries)
                .withStrokeStyle(0xFFCCCCCC, 2f)
                .withBubbleBrushStyle(new SolidBrushStyle(0x77CCCCCC))
                .build();
    
        UpdateSuspender.using(surface, () -> {
            Collections.addAll(surface.getXAxes(), sciChartBuilder.newNumericAxis().build());
            Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().build());
    
            Collections.addAll(surface.getRenderableSeries(), bubbleSeries);
        });
    }
    
    override fun initExample(surface: SciChartSurface) {
        val bubbleSeries = FastBubbleRenderableSeries().apply {
            val doubleType = Double::class.javaObjectType
    
            dataSeries = XyzDataSeries(doubleType, doubleType, doubleType).apply {
                append(0.0, 0.0, 1.0)
                append(1.0, 1.0, 0.0)
                append(2.0, 4.0, 0.0)
            }
    
            strokeStyle = SolidPenStyle(-0x333334, true, 2f, null)
            bubbleBrushStyle = SolidBrushStyle(0x77CCCCCC)
        }
    
        UpdateSuspender.using(surface) {
            Collections.addAll(surface.xAxes, NumericAxis(context))
            Collections.addAll(surface.yAxes, NumericAxis(context))
    
            Collections.addAll(surface.renderableSeries, bubbleSeries)
        }
    }
    

    Bubble Series Features

    Bubble Series also has some features similar to other series, such as:

    • Render a Gap;
    • Draw Series with Different Colors.

    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.

    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml