SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
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).
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,
Please login first to submit.