SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
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.