Optimize 10,000+ Dots Chart

I have a chart that can contain many points (10000 +). When I scale the chart to see all the points on the screen, it takes some time to draw them.

Scaled chart

Can you advise me some optimization so as not to draw all the dots

+4
source share
4 answers

I am not a specialist in the listed technologies, but I would decide to " bucketing " your data.

Your X axis is time , so define a resolution point for the current size of the chart. IE, if you see the whole graph, you will need, for example, a data point per day . If you scale in a long way, you may need a point per hour .

Now you have determined the resolution, look at your chart and find all the data that exists between the resolution points, IE, all data > 20th April 2011 at 4pm and < 20th April 2011 at 5pm if you are on an hourly basis.

Depending on the type of data you are using, determine if you want average all the data you collected, or find median (or some other method, such as a candle stick chart , to show max / min values). In any case, select the most suitable method, repeat all the points and make the result with the new data.

Hope you have in mind.

+7
source

It looks like you should use the Level of Detail (LoD) algorithm.

For example: Always use the maximum given set of points to represent all of your actual points. By calculating local minima and maxima , you can create the correct representation of a given set of points for a specific "part", depending on how much you are enlarged in.

Calculating these extremes can be slow, so you may need to cache them. You can count and cache this on the fly as new data arrives.

+3
source

In addition to other good suggestions, I would

  • Take a few random pauses on it to make sure that it does something else for a long time that can be avoided, for example, it can highlight new point structures all the time.

  • Instead of drawing directly in the window, draw a bitmap image and copy it to the window. It always looks faster, and sometimes even faster. (Be sure to remove the method that clears the background of the window.)

0
source

I had a serious performance issue, and thousands of rows were added to the chart, not thousands of points. The solution that worked for me was the taste of the Flyweight template:

  • Instead of adding 1000-second series, add only one.
  • At the end of the virtual series, i.e. when all points of the series are added and the transition time to the next, insert an empty point:

     series.Points.Add(new DataPoint(0, 0) { IsEmpty = true }); 

Hope someone helps.

0
source

All Articles