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

0
0

I have a line chart using an XYDataSeries<DateTime, double> and set the FifoCapacity on the data series to 600. I am sampling the data at a sample rate of 100 ms, which equates to 1 minute of data. When I set the visible range to 2 minutes I can see more data then 1 minute’s worth. In fact, the data series actually has about 1080 points in it. I have verified that the FifoCapacity is in fact 600 on the series.

As new data comes in it is being appended:

_dataSeries.Append(valueSample.Time, valueSample.Value);

Does the chart only overwrite old data if memory constraints require it to? Not sure what is going on.

Version
6.1.1.13136
Images
  • You must to post comments
0
0

Hi Patrick

When DataSeries.FifoCapacity is set to a value (e.g. 600), the DataSeries initializes as a circular buffer of size 600. When you append points over the end of the buffer, they are written back to the start (we overwrite old data).

This is verified in Unit Tests in our source-code, for example tests like this:

    [Test]
    public void ShouldComputeMinMaxAndTruncateWhenXyIsGreaterThanFifo()
    {
        var dates = TestUtil.GetDateSeries(new DateTime(2011, 01, 01), 10);
        var values = new[] { 10.2, 11.3, 9.8, 8.6, 12.5, 15.1, 14.3, 13.9, 13.8, 14.0 };

        var dataSeries = new XyDataSeries<DateTime, double>();

        // Setting FifoCapaicty to 2
        dataSeries.FifoCapacity = 2;

        // but appending 10 values
        dataSeries.Append(dates, values);

        // Should result in all but the last 2 being discarded
        Assert.That(dataSeries.Count, Is.EqualTo(2));
        Assert.That(dataSeries.XValues, Is.EquivalentTo(dates.Skip(8)));
        Assert.That(dataSeries.YValues, Is.EquivalentTo(values.Skip(8)));
        Assert.That(dataSeries.XMin, Is.EqualTo(dates.ElementAt(8)));
        Assert.That(dataSeries.XMax, Is.EqualTo(dates.ElementAt(9)));
        Assert.That(dataSeries.YMax, Is.EqualTo(14.0));
        Assert.That(dataSeries.YMin, Is.EqualTo(13.8));
    }

It doesn’t matter about the size of memory used.

I can’t fathom why this would happen, but I would suggest to check:

  • Are you sure DataSeries.FifoCapacity is set and is not unset somewhere
  • Is the correct DataSeries applied to a RenderableSeries?
  • Is the DataSeries cloned somewhere or copied and FifoCapacity not set on the clone?

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.