Highcharts doesn't display series with lots of data points

前端 未结 2 2110
南方客
南方客 2021-02-13 12:55

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 point

相关标签:
2条回答
  • 2021-02-13 13:26

    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.

    0 讨论(0)
  • 2021-02-13 13:28

    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);
                    }
    
    0 讨论(0)
提交回复
热议问题