Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refresh the chart very quickly if I have a very large number of data to be shown in Microsoft Chart

Tags:

c#

charts

I am using C#, and would like to plot a line chart to visualize my data, the data could be stored as a double array, the number could be very large, over 100000 maybe, and I also would like to update the data source all the time, but when I use the Microsoft Win Chart, the refresh rate will be very slow if the number is too large (20000 would give a very bad user experience), I use the FastLine/FastPoint chartType, but it did not give me too much improvement, and I also tried to directly bind the data to the Points.DataBindY method, still, does not feel very well.

Is there anyone has experience on how to deal with this?

Many thanks.

like image 564
user1348389 Avatar asked Sep 14 '25 13:09

user1348389


2 Answers

You're going to find that trying to chart that number of points (100k) is going to overwhelm even the most powerful of charting controls. And I would question why it's even necessary to do that. How can you possibly differentiate 100k points on a chart? It seems unnecessary. Most charting controls (I'm most familiar with WPF controls) allow you to 'sample' the data (via a sampling threshold). This permits you to still retain the general shape of the data, but do so with far fewer data points, and much better performance.

Also, be very careful when binding data. With many charting controls, when you bind data, each data point bound to the chart causes a refresh of the chart. You can imagine what 100k refreshes would do :(. If you can, find a way to refresh the chart after all the data has been bound to the chart.

like image 88
Randy Minder Avatar answered Sep 16 '25 03:09

Randy Minder


A solution might be to reduce the scale to 1:10000, greatly reducing drawn points while keeping the same draw.

You could do this by working on the data array before giving it to the chart.

like image 26
Al3x Avatar answered Sep 16 '25 05:09

Al3x