Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize Chart with 10000+ points

I have chart that can contain a lot of points (10000 +) When I scale the chart in order to see all points in screen, it takes some time to draw them

Scaled chart

Can You advice me some optimization, in order not to draw all points

like image 408
Zlobaton Avatar asked Dec 27 '22 22:12

Zlobaton


1 Answers

I'm not an expert with listed technologies, but I would solve this by 'bucketing' your data points.

Your X axis is time, so determine the resolution point for the current chart size. IE, if you are seeing the entire chart you will only need a data point per day for example. If you are zoomed in a long way, you might want a point per hour.

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

Depending on the type of data you are using, will determine if you want to average all the data point you have collected, or find the median (or some other method, such as a candle stick chart to show the max/min values). Either way, pick the most relevant method, repeat for all points and render the result with your new data.

Hope that's what you meant.

like image 94
Tom Gullen Avatar answered Jan 24 '23 05:01

Tom Gullen