user1348389
user1348389

Reputation: 41

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

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.

Upvotes: 4

Views: 14442

Answers (4)

bh_earth0
bh_earth0

Reputation: 2818

try this:

chart1.Series[0].ChartType = SeriesChartType.FastLine;

or

chart1.Series[0].ChartType = SeriesChartType.FastPoint;

In cases when you need to draw more than 100,000 data points you may also consider using FastLine and FastPoint chart types. They do not support all the features of the regular Line and Point chart but will SIGNIFICANTLY improve chart performance.

https://blogs.msdn.microsoft.com/alexgor/2008/12/02/microsoft-chart-control-how-to-improve-chart-performance/

for other type of charts . idk either.

Upvotes: 1

Al3x
Al3x

Reputation: 125

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.

Upvotes: 1

RogueBudz
RogueBudz

Reputation: 115

Tried to leave as a comment but can't due to rep, to update the chart manually every 'x' many points:

https://stackoverflow.com/a/10621610/1360625

Has a massive effect on speed and efficiency.

Upvotes: 0

Randy Minder
Randy Minder

Reputation: 48402

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.

Upvotes: 2

Related Questions