我已經看了很多例子。然而,我仍然堅持這一點。我如何解析這個JSON響應以與我的Highstock Highchart一起工作?JSON解析爲Highcharts
[{"averageprice":"18.7","date":"2000-01-01"},{"averageprice":"41.73","date":"2000-01-02"},{"averageprice":"34.27","date":"2000-01-03"},{"averageprice":"30.06","date":"2000-01-04"}]
這裏是我的圖表到目前爲止...
$.getJSON('http://example.com/dailyaverages.json', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart : {
renderTo : 'ppcontent'
},
rangeSelector : {
selected : 0
},
title : {
text : 'Trade Prices'
},
xAxis: {
type: 'datetime'
},
series : [{
data : data
}]
});
});
大多數現代瀏覽器都支持'JSON.parse()'方法,它的名字的確如此。 – 2013-01-06 05:29:14