Linger
Linger

Reputation: 15048

Highcharts doesn't display series with lots of data points

I have a chart that I would like to display based on a date range from the user. This particular chart has a data point for every 15 minutes. So there can be a lot of data points for each series if a users selects a large date range. Here is a couple of examples:

In the first example the chart does display. In the second example the chart does not display. There is a Highstock demo (52,000 points with data grouping) that works with a lot of data points. I have tried to change the above charts to a highstock chart and still have the same results.

What can I do to fix this?

Upvotes: 13

Views: 21733

Answers (2)

Dangerdave
Dangerdave

Reputation: 51

a workaround for turboThreshhold is something like this if you generation your response with PHP:

if (count($responseObj) > 1000) {
    $modolo = round(count($responseObj) / 1000);
    for ($i = count($responseObj) - 1; $i >= 0 ; $i--) {
        if (($i % $modolo) != 0) {
            unset($responseObj[$i]);
        }
    }
    $responseObj = array_merge($responseObj);
}

Upvotes: 0

Greg Ross
Greg Ross

Reputation: 3498

This is due to the turbo threshold option:

"When a series contains a data array that is longer than this, only one dimensional arrays of numbers, or two dimensional arrays with x and y values are allowed. Also, only the first point is tested, and the rest are assumed to be the same format. This saves expensive data checking and indexing in long series."

It is set to 1000 points by default. Your chart is not rendering because each point in your series is an object and their number is greater than the threshold.

Here's a jfFiddle demonstrating your plot working with the threshold set to 2000.

Here's the modified section of code:

plotOptions: {
     spline: {
     turboThreshold: 2000,
    ...

Another solution would be to encode your series data in a 2-d array instead of having each point represented by and object with x-y properties.

Upvotes: 26

Related Questions