0
API에서 데이터를로드 한 후에 계열을 추가 중입니다. 시리즈 데이터가 표시되지 않는 것이 문제입니다. 차트를 만들 때 시리즈를 바로 추가 한 것과 같은 데이터 형식이 있습니다. 내 JSON 및 모든 데이터를 통해 검사하고 그 모든 괜찮습니다 확인했습니다.하이 차트에 데이터가 표시되지 않습니다.
코드 :
var overallGraph;
$(document).ready(function() {
updateGraph();
function updateGraph() {
$.post('../api/overall-lookup.php?d=4', function(json) {
var guildData = [];
var textCData = [];
var offiUData = [];
for(var i = 0; i < 4; i++){
var data = json['lookup-results'][i];
guildData.push(data['guilds']);
textCData.push(data['text_channels']);
offiUData.push(data['official_users']);
}
overallGraph.addSeries({'name': 'guilds', 'data': guildData}, true);
overallGraph.addSeries({'name': 'text channels', 'data': textCData}, true);
overallGraph.addSeries({'name': 'official users', 'data': offiUData}, true);
});
}
overallGraph = Highcharts.chart('container', {
title: {
text: 'Overall Data For FlareBot',
x: -20
},
xAxis: {
title : {
text: 'Date'
}
},
yAxis: {
title: {
text: 'Amount'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
}
});
});
출력 :
JSON
{
"code": 300,
"lookup-results": [
{
"date": "2017-01-01",
"guilds": "759",
"text_channels": "4320",
"official_users": "79"
},
{
"date": "2016-12-31",
"guilds": "756",
"text_channels": "4409",
"official_users": "81"
},
{
"date": "2016-12-30",
"guilds": "717",
"text_channels": "4225",
"official_users": "82"
},
{
"date": "2016-12-29",
"guilds": "700",
"text_channels": "4137",
"official_users": "78"
}
]
}
json을 여기에 붙여 넣을 수 있습니까? – morganfree
여기 : https://pastebin.com/bNkhNwf3 @morganfree – bwfcwalshy