Hi – I’m making charts as WPF controls and using multiple versions in a single WinForms app.
1) From a performance standpoint, is that approach likely to be a problem? We’re looking at 3 graphs streaming the same data at the moment.
2) What are the best practices for streaming the same set of data (about 90 readings per second) to multiple charts? Currently, each one has its own series, and adds readings to it on their own and things slow down quite a bit. What is the right way to approach the handling of data for multiple charts?
Thanks for your help!
- plytle asked 11 years ago
- You must login to post comments
Hi there, and thanks for your enquiry,
Can you tell me a bit more about the use-case, i.e. why you are displaying 3 graphs with the same data? I’m just interested to know that’s all!
I would suggest trying to create a single DataSeriesSet and sharing this between the three charts. Then when you append to it, all three should redraw automatically. I say *should because we haven’t actually tried this yet.
I would not think having 3 graphs would be a performance issue, we have customers that show up to 30 charts (e.g. in a trading application) across multiple monitors, and many that show 5-10 charts in a streaming real-time context.
I would suggest the following performance tips when appending:
- Try to batch appends using DataSeries.Append(IEnumerable x, IEnumerable y), not DataSeries.Append(double x, double y). This is because each append requires additional min/max calculations and triggers a redraw.
- Try when batch appending to pass in arrays not LINQ or Lists. Arrays are indexed about 10x faster than Lists in some cases.
- Try setting SciChartSurface.RenderPriority = RenderPriority.Low. This results in fewer redraws which generally speeds things up (especially helps with mouse stutter).
- When doing multiple operations on a DataSeries, use the following code (below) to suspend and resume updates.
// Method 1 using (sciChartSurface.SuspendUpdates()) { // Do your work here // .. }// Triggers redraw here // or // Method2 using (DataSeriesSet.SuspendUpdates()) { // Same as above, just a different way into the API }
Let me know if that helps!
- Andrew
- Andrew Burnett-Thompson answered 11 years ago
-
Thanks very much for the thoughts. Just tried "SciChartSurface.RenderPriority = RenderPriority.Low" at first, and it's noticeably better. To answer your question, at the moment, the charts have different views of the same data, and handle "scrolling" the live data differently. Ultimately, the charts may contain different sets of actual numbers - if not, we'll probably have them share the same xy series. Thanks again for your help.
-
No problem glad to be of help! Also see our Performance Tips and Tricks, which contain many important points for getting the best performance out of SciChart. Best regards, Andrew
- You must login to post comments
Please login first to submit.