1

I have a fast acquisition to show on an a SciChart and application that should run for long time without consuming all the RAM of the PC.

It is not necessary that I display all points on the graph but just a certain recent time interval therefore I thought to remove points from series when I don't want to display those anymore.

I tried the XyDataSeries.RemoveRange method but when I invoke that I got the following exception:

System.NotSupportedException: 'Remove is not a supported operation on a Fifo Buffer'

What to you suggest to overcome this issue?

Drake
  • 8,225
  • 15
  • 71
  • 104

1 Answers1

0

Only way to workaround this is to not have a FIFO buffer and manually use the Insert/Append and Remove functions of the DataSeries to maintain a certain number of points.

For example

public class Foo
{
    private XyDataSeries<double> _ds = new XyDataSeries<double>();

    private const int FifoCapacity = 1000;

    void AppendPoint(double x, double y)
    {
        using (_ds.SuspendUpdates())
        {
            _ds.Append(x,y);
            if (_ds.Count > FifoCapacity)
            {
                _ds.RemoveAt(0);
            }
        }
    }   
}

Now you can use Remove, RemoveRange, RemoveAt on your custom series.

Please note that as per SciChart's WPF Charts Performance Tips and Tricks documentation appending / removing in bulk is far more performent than one point at a time.

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178