Pre loader

Pre-load real-time chart with existing data then continue adding individual points in real-time

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

0
0

In my application I collect several channels of data at regular intervals on separate threads into a circular buffer of fixed size. The user can switch to a variety of screens (views), each of which may want to display real-time charts of this data. What I need to do is fill the chart with the existing contents of the buffer when the screen is initially loaded and then continue updating that data (and hence the chart) in real time. My speed requirements are not nearly as fast as your real-time examples.

So the question is, what is the best approach for this? Should I perform a special sequence of events when loading the view to loop through the existing data and add all of those points all at once, then resume normal real-time operation where points are added individually? Or is it better to simply bind the chart directly to the data buffer and have it completely invalidate and redraw as each point is added – somewhat simulating real-time (doesn’t seem ideal, but I’ve seen this work in the past).

Thanks

  • You must to post comments
0
0

It depends on the effect of what you want to achieve.

From a perforamnce perspective, I can advise you that appending a block from an array, e.g.

double[] xValues = ... 
double[] yValues = ...
dataSeries.Append(xValues, yValues);

is much faster than appending point by point, e.g.

double[] xValues = ... 
double[] yValues = ...
for(int i = 0; i < xValues.Length; i++)
    dataSeries.Append(xValues[i], yValues[i]);

so if it’s a fast switch between views you want, I would suggest first buffering the values into an array, or in blocks of size 1000, and appending each block. This will allow for a very fast append and almost no delay in changing data.

The other thing I can advise you is to suspend updates on the SciChartSurface, or the dataseries, when appending to prevent redraw as the data is manipulated.

Both of these tips are covered in our Performance Tips and Tricks article.

Once you have the view loaded, sure, appending data as it arrives is fine, but again it depends on the effect you want to achieve.

Hope this helps,
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