02-28-2020 05:26 AM
We are trying to plot data in a wpf graph, where adjuster is set to ContinuousChart and render mode is set to raster mode, but are seeing very high CPU usage. Data is residing in an ObservableCollection and new data is added with an interval of 0.1 seconds. I have attached an example, which is a slightly modified code I found in the forum (don’t remember which case). The code preloads 9000 points of data in four datasets and then continuous to add new data every 0.1 second. Initially the CPU usage is quite high, and continuous to increase as points are added. When the number of points hits 10000 the CPU usage increase even further. What is the reason for the high CPU usage? Is there anything I can do to improve the CPU usage? I notice that it is not correlating to the number of points, if I start with 900000 points I get same CPU usage, why? I do see that it correlates somehow to the data, i.e. the area inside the graph filled with lines between the datapoints.
Solved! Go to Solution.
02-28-2020 05:04 PM
I have not had a chance to review things in detail, but wanted to cover some of the top points I noticed:
ObservableCollection
, which is a general-purpose collection that has not been optimized for data storage. For charting applications, the Measurement Studio chart collection types are the recommended approach, as these are optimized to work with the graph.In fact, the project you attached looks like a (slightly modified) version of the Measurement Studio charting example, which uses a chart collection. Unfortunately, it will be hard to give more specific advice from an example that does not match your actual use case, but I hope these points help!
02-29-2020 09:34 AM
Hi,
I am sorry, I meant to write that data is residing in ChartCollections. You are correct, if I switch to hardware rendering the CPU drops significantly. Not sure what is going on with the raster rendering. Thanks for the recomandation link, hadn’t seen this page before.
Oddvar
03-01-2020 01:11 AM
Hi,
One more thing. I tried having rendering in auto mode. But then CPU went high again. Hence, I need to set hardware mode explicitly, but I guess that should be fine.
Oddvar