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

0
0

Hi

I am developing a Xamarin iOS application and I’m using a SCIPieChartSurface. I can create the chart and set its values, but is is not possible to auto-update the donut with new data.
I am trying to update the value by doing:

myDonut.MyPieSegment.Value = newValue;

But nothing happends…

I heard it was a bug in the API for Android a month ago, is this similar? Or am I doing something wrong?
Thanks in advance!

Best regards
Jonas

Version
2.1.0.769
  • You must to post comments
0
0

Hello Jonas,

Thanks for reporting this. It looks like an issue in sciChart and I’ve already created task in our bugtracker, so it will be fixed in one of our future releases.

As for now, what you can do – is manually trigger redraw by calling invalidateElement on your series like below:

myDonut.InvalidateElement();

That’s it. Sorry for inconvenience. Hope this is suitable for your needs.

Best Regards,
Nazar

  • Jonas Olsson
    Hello Nazar Sorry, but this workaround doesn’t work either. I’ve tried to run the InvalidateElement-command on both the SCIRenderableSeries and its SCIPieSegments-objects. It makes no sense. myDonut.MySeries.InvalidateElement(); myDonut.MyPieSegment.InvalidateElement(); When do you expect to solve this issue? Best regards Jonas
  • Nazar
    Hi Jonas, in that case I would ask you to provide some code which reproduces this issue, because I can’t do that locally in our examples app. Also, I can’t give you any ETA for resolving this issue, since we have working workaround for now. But for sure it will be fixed in on of our future releases. Best Regards, Nazar
  • Jonas Olsson
    Hi Nazar. Code is provided in my answer below (I couldn’t format the code in the response).
  • You must to post comments
0
0

Hi Nazar, sorry for late response. Still not working for me, I’ve made some changes in your provided test application Xamarin.Examples.Deploy. In the code below I expected the pie chart to auto-update every 5000ms, but it is not. However, if I click somewhere in the pie chart, it will update to the expected value. But I want it to update automatically. The InvalidateElement-command doesn’t seem to affect at all.

    SCIDonutRenderableSeries donutSeries = new SCIDonutRenderableSeries();
    SCIPieSegment segment;
    protected override void InitExample()
    {
        donutSeries.IsVisible = false;
        segment = BuildSegmentWithValue(40, "Green", new SCIRadialGradientBrushStyle(0xff84BC3D, 0xff5B8829));
        donutSeries.Segments.Add(segment);
        donutSeries.Segments.Add(BuildSegmentWithValue(10, "Red", new SCIRadialGradientBrushStyle(0xffe04a2f, 0xffB7161B)));
        donutSeries.Segments.Add(BuildSegmentWithValue(20, "Blue", new SCIRadialGradientBrushStyle(0xff4AB6C1, 0xff2182AD)));
        donutSeries.Segments.Add(BuildSegmentWithValue(15, "Yellow", new SCIRadialGradientBrushStyle(0xffFFFF00, 0xfffed325)));
        donutSeries.DrawLabels = true;

        Surface.RenderableSeries.Add(donutSeries);
        Surface.RenderableSeries.Add(donutSeries);
        Surface.HoleRadius = 100;
        Surface.BackgroundColor = UIColor.White;

        var legendModifier = new SCIPieLegendModifier();
        legendModifier.Position = SCILegendPosition.Bottom;
        legendModifier.PieSeries = donutSeries;

        Surface.ChartModifiers.Add(legendModifier);
        Surface.ChartModifiers.Add(new SCIPieSelectionModifier());

        Task.Run(() =>
        {
            donutSeries.StartAnimation();
            donutSeries.IsVisible = true;
        });

        System.Threading.Timer t = new System.Threading.Timer(callback, null, 100, 5000);
    }
    Random rnd = new Random();
    private void callback(object state)
    {
        segment.Value = rnd.Next(1, 20);

        donutSeries.InvalidateElement();
    }
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.