Highcharts 使用getjson重新驱动序列名称和数据
我试图从一个JSON格式的文件中检索这个系列的名称和数据Highcharts 使用getjson重新驱动序列名称和数据,highcharts,Highcharts,我试图从一个JSON格式的文件中检索这个系列的名称和数据 [{“名称”:“gfs00”,“数据”:[[1359676800000,30],[1359687600000,32]},{“名称”:“gfs06”,“数据”:[[1359676800000,28],[1359687600000,29]}] 以下是highchart代码: var data_temp; $.getJSON('dati/performance_gfs/precipitazioni/pioggia_live_data.php'
[{“名称”:“gfs00”,“数据”:[[1359676800000,30],[1359687600000,32]},{“名称”:“gfs06”,“数据”:[[1359676800000,28],[1359687600000,29]}]
以下是highchart代码:
var data_temp;
$.getJSON('dati/performance_gfs/precipitazioni/pioggia_live_data.php',
{ run: runs_gfs} ,function(data_temp){
for (var i = 0; i <data_temp.length ;i++){
chart.addSeries({
data:data_temp,
});
}
});
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container_temperatura_windchill_heatindex',
defaultSeriesType: 'line',
zoomType: 'x',
},
title: {
text: 'Ensemble'
},
xAxis: {
type: 'datetime'
},
yAxis: [{ // Primary yAxis
id:0,
labels: {
formatter: function() {
return this.value +'°C';
},
style: {
color: '#89A54E'
}
},
title: {
text: 'Temperature',
style: {
color: '#89A54E'
}
}
}],
plotOptions: {
line: {
lineWidth: 1,
states: {
hover: {
lineWidth: 2
}
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
symbol: 'circle',
radius: 5,
lineWidth: 1
}
}
},
pointInterval: 24 * 3600000, // one hour
pointStart: Date.UTC(2012, 9, 6, 0, 0, 0)
}
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
Highcharts.dateFormat('%d-%m-%Y %H:%M', this.x)+'<br/>'+
this.y;
}
},
series: []
});
});
}
var数据_-temp;
$.getJSON('dati/performance\u gfs/precipitazioni/pioggia\u live\u data.php',
{run:runs_gfs},函数(data_temp){
对于(var i=0;i请尝试以下操作:
for (var i = 0; i <data_temp.length ;i++){
chart.addSeries(data_temp[i], false);
});
chart.redraw();
for(var i=0;您好,欢迎来到SO!我编辑了您的文章以改进格式。