缓慢加载数据highstock

时间:2016-05-26 10:41:25

标签: javascript highstock

我的高品质表现有问题。所有工作,但绘制我的数据的时间太慢,大约30秒。 JSON约为30000分。也许我如何绘制这些数据有问题?我已经关闭动画,阴影,标记等。

enter image description here

这是我的JS代码:

$(function() {
    Highcharts.setOptions({
        global: {
useUTC: false,
            timezoneOffset: - 3 * 60
        }
    });
function requestData() {
$.ajax({
    url: 'values.php',
    success: function(series) {
        chart.addSeries({name: 'Temp1', data: series[0], yAxis:0},       false);
        chart.addSeries({name: 'Temp2', data: series[1], yAxis:0}, false);  
        chart.redraw();
    },
    cache: false
});
}
chart = new Highcharts.StockChart({
    chart: {
    animation: false,
        zoomType: 'xy',
        renderTo: 'container',
        events: {
            load: requestData
        }
    },
title: {
            text: 'Temperatures from DS18B20',
            x: -20 
        },                  
plotOptions: {
                    spline: {
                        turboThreshold: 50000
                    }
                },
rangeSelector: {
allButtonsEnabled: true,
buttons: [{
type: 'minute',
count: 10,
text: '10min'
}, {
type: 'minute',
count: 30,
text: '30min'
}, {
type: 'all',
text: 'all'
}],
buttonTheme: {
width:60
     },
selected: 2
},


 xAxis: {
   type: 'datetime',
   categories: true,
   ordinal: false,
    //   tickInterval: 100*3600,
   minTickInterval:100000,
   labels: {
     align: 'center',
          formatter:function(){
     return Highcharts.dateFormat('%H:%M:%S',this.value);
     }
   }
 },
    yAxis: {
        labels: {
            format: '{value}°C',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        title: {
            text: 'Temperature',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        opposite: false
    },
    legend: {
        enabled: true,
        align: 'right',
        backgroundColor: '#DBFFDB',
        borderColor: 'black',
        borderWidth: 2,
        layout: 'vertical',
        verticalAlign: 'top',
        y: 200,
        shadow: true
    },

    tooltip: {
        shared: true
    },
    series: []
});
});

0 个答案:

没有答案