ハイチャートJSを使用してグラフをプロットしようとしています。 Y軸であるべきhttps://api.myjson.com/bins/gdpu7
リモートJSONファイルからハイチャートグラフをプロット
receive_date
X軸とresponses
する必要があります - :私は、JSONが
[{"receive_date":"2013-11-04","responses":"2"}]
、同様に、JSONファイルを持っています。私はリモートJSONデータをロードしてHighchartsに渡しています。しかし、X軸にreceive_date
というキーを割り当て、Y軸にresponses
というキーを割り当てることをお勧めします。
JSFiddle: -
http://jsfiddle.net/273x2f13/1/
// Create the chart
$.getJSON("https://api.myjson.com/bins/gdpu7", function(data){
chart: {
type: 'column'
},
title: {
text: 'Date Vs Rsponses'
},
subtitle: {
text: 'Chart View Here'
},
xAxis: {
type: 'category'
},
yAxis: {
title: {
text: 'Responses'
}
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y:.1f}%'
}
}
},
tooltip: {
headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
},
series: [{
x: 'receive_date',
y: 'responses'
colorByPoint: true,
data: data
}]
});
私はそれをX軸とY軸の値を与えるために、これを使用しています。しかし、それは正しいわけではありません。
series: [{
x: 'receive_date',
y: 'responses'
colorByPoint: true,
data: data
}]