Pre loader

XyDataSeries Update

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


Hello is there way to update points in XyDataSeries without Garbage Collector call? Here is my code:

public void RefreshSignal(float[] xData, float[] yData)
        if (_series == null)
             _series = new XyDataSeries<float, float>();
            _series.Append(xData, yData);

         for (int i = 0; i < xData.Length; i++)
               _series.Update(xData[i], yData[i]);

I may use _series.YValues[i], but then UI will not update.

Main task for me fast update all 25k points in series each 30ms without GC calls.

  • You must to post comments

Hi Kontstantin,

You say you’re using the latest version of SciChart, but there is no XyDataSeries.Update(TX x, TY y) method in v5.x or v6.x any more. I think this was removed some time ago. Are you using an older version?

The function signature for v5.x is like this:

    /// <summary>
    /// Updates the X,Y point at the specified index.
    /// </summary>
    /// <param name="index">The index of the data value to update.</param>
    /// <param name="y">The new Y value.</param>
    /// <exception cref="InvalidOperationException">Thrown if the <paramref name="index" /> does not exist in the DataSeries.</exception>
    public void Update(int index, TY y)

Inside this function it sets the YValue[i] then performs some calculations to determine the dataSeries data distribution. These are required for correct operation of SciChart but do not require memory. An older version may be less memory efficient (im not sure without knowing which version exactly)

Best regards,

  • Konstantin Shapovalov
    I am using v5, it has both Update methods. Anyway after Update(int index, TY y) calling GC.
  • Andrew Burnett-Thompson
    Thanks Konstantin, you’re right — it is in there, my mistake. The code for these methods is pretty slim. Update(x,y) does a Binary Search (Find index) first. This is slower, but does not use more memory. Update(int index, y) simply places the value in the array. It doesn’t actually use memory in this part – but it will use memory later when we draw. There is not much we can do about this, we need memory to draw! SciChart (especially v6) is the world’s most efficient & fastest WPF chart. We can improve on it somewhat, but it would require expert optimisation at an hourly rate from our side to do so. Why don’t you try out v6 BETA? It’s very very quick:
  • Konstantin Shapovalov
    As I understand you are using WriteableBitmap, so as the size of bitmap the same, you do not need relocate the new memory. This is not so difficult to rewrite WriteableBitmap BackBuffer. If you are interest, I may fix the code for you for free. About v6, I am prefer use stable versions.
  • Andrew Burnett-Thompson
    Hi Konstantin, we do lot more than write just to WriteableBitmap. If you are a source-code customer and want to submit a pull request, please feel free. We can analyse it and include into our codebase. Best regards, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies