I am showing a graph on HTML5 canvas using the flot charting library for a between a start date and an end date. It's fine as long as the period is less than a year or so but if the user selects a big time period I will have to send large dataset and have browser process it every now and then. We have data points on daily basis.

What would be a good approach to solve an issue like this ? I am guessing it will require some normalization of data and rejecting certain datapoints based on how long the time period is.

Or I should restrict user to a max time period range ?

  • 2
    Would maybe depend on type of data and how it's displayed. Would not make much sense to send data if the user can't view it anyway. Otherwise limit to data points or calculate median/average for certain time slices like weeks or months if that makes sense for your use case. Also limiting what the user can select would be applicable if this doesn't infer with the work they do. Again there is no general rule. Aug 5, 2015 at 8:26

2 Answers 2


You can pre-compute the statistic you want to show for each date. Then you just send the user 360*years data points, which are few enough for the slowest computer.


If I understood well, you want to keep the number of your data points (for consideration) bounded under a computation-friendly threshold, including in the case of long periods of time, yet have your charting "pretend" as if it had processed many more / all of them. In that case, this might be a good use case for picking some type of interpolation method over your discrete input set.

'Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.