Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Real time chart update

I created an application with a line chart, and I want every 100 millisecond graph update all its points (the points are 100 totally).

I would like to see on the screen a graphic that acts as an oscilloscope.

The points update is very slow and does go the device out of memory.

There is a more efficient method to redraw blocks of points very frequently?

There is my code:

    AccellThread = new Thread(new ThreadStart(UpdateData));

    private void LoadData()

        for (var i = 0; i < 100; i++)
            dataX.Add(new ChartDataPoint(i, GetRandomNumber(-1.0, 1.0)));
            dataY.Add(new ChartDataPoint(i, GetRandomNumber(-1.0, 1.0)));
            dataZ.Add(new ChartDataPoint(i, GetRandomNumber(-1.0, 1.0)));

    private void UpdateData()

        for (; ; )
            RunOnUiThread(new Action(delegate


    private static readonly Random random = new Random();
    private static readonly object syncLock = new object();

    public double GetRandomNumber(double minimum, double maximum)
        lock (syncLock)
            return random.NextDouble() * (maximum - minimum) + minimum;

This code is for SyncFusion library but i test also GraphView and the results are the same.
Any help?

Sign In or Register to comment.