SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0
0

Has anyone ever encountered this problem?
Could you give me a help? How to solve this problem?
The app didn’t run in the method of ‘getStrokeColors()’, when I debugged.

public class BubbleChartFragment extends ExampleBaseFragment {
    ...

    {
    ...
    FastBubbleRenderableSeries mRSeries = sciChartBuilder.newBubbleSeries()
                    .withDataSeries(dataSeries)
                    .withZScaleFactor(zScaleFactor / 10f)
                    .withBubbleBrushStyle(new SolidBrushStyle(0xffff0000))
                    .withAutoZRange(false)
                    .withStrokeStyle(0xff00ff00, 20f)
                    .withPaletteProvider(new StrokePaletteProvider())
                    .build();
    }

    private class StrokePaletteProvider extends PaletteProviderBase<FastBubbleRenderableSeries> implements IStrokePaletteProvider {
            private final IntegerValues colors = new IntegerValues();
            private final int[] desiredColors = new int[]{0xFF00FF00, 0xFF0000FF};

            protected StrokePaletteProvider() {
                super(FastBubbleRenderableSeries.class);
            }

            @Override
            public void update() {
                final BubbleRenderPassData currentRenderPassData = (BubbleRenderPassData) renderableSeries.getCurrentRenderPassData();

                final int size = currentRenderPassData.pointsCount();
                colors.setSize(size);

                final int[] colorsArray = colors.getItemsArray();
                final int[] indices = currentRenderPassData.indices.getItemsArray();
                for (int i = 0; i < size; i++) {
                    final int index = indices[i];
                    colorsArray[i] = desiredColors[index % 2];
                }

            }

            @Override
            public IntegerValues getStrokeColors() {
                return colors;
            }
        }
    }
Version
2.1.0
  • You must to post comments
0
0

Hi SiYuan Ou,

Unfortunately FastBubbleRenderableSeries doesn’t support IStrokePaletteProvider. For now it supports only IFillPaletteProvider interface which will provide fill color for entire bubble:

    private static class BubblePaletteProvider extends PaletteProviderBase<FastBubbleRenderableSeries> implements IFillPaletteProvider {
    private final IntegerValues colors = new IntegerValues();
    private final int[] desiredColors = new int[]{0xFF00FF00, 0xFF0000FF};

    BubblePaletteProvider() {
        super(FastBubbleRenderableSeries.class);
    }

    @Override
    public void update() {
        final BubbleRenderPassData currentRenderPassData = (BubbleRenderPassData) renderableSeries.getCurrentRenderPassData();

        final int size = currentRenderPassData.pointsCount();
        colors.setSize(size);

        final int[] colorsArray = colors.getItemsArray();
        final int[] indices = currentRenderPassData.indices.getItemsArray();
        for (int i = 0; i < size; i++) {
            final int index = indices[i];
            colorsArray[i] = desiredColors[index % 2];
        }

    }

    @Override
    public IntegerValues getFillColors() {
        return colors;
    }
}

Is this suitable for your needs?

Best regards,
Yura

  • SiYuan Ou
    But the bubble of IOS can code to set the stroke like my example. I think so, Android can code too;
  • Yura Khariton
    Well iOS bubbles are rendered differently than Android bubbles ( iOS renders them as ellipses and in Android for better performance they are rendered as sprites ) and because of this differences we can’t support IStrokePaletteProvider in Android. I’m going to create a task in our bugtracker to investigate if we can improve this but it would require rewriting of bubble series so it will take some time
  • SiYuan Ou
    OK. Thank you!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more
+