var chartData;
$(function(){
$.ajax({
url: 'http://localhost:3300/temp',
type: 'GET',
dataType: "json",
success : function(data) {
chartData = data;
console.log(JSON.stringify(chartData));
var chart = new Highcharts.Chart({
chart: {
renderTo: 'chart-location',
type: 'line',
marginRight: 130,
marginBottom: 25,
height : 400,
},
title: {
text: 'Packet Number',
x: -20 //center
},
xAxis: {
categories: data["categories"]
},
series: [
{
name: 'paketNo',
dataFormat: 'json',
data: chartData
}
]
});
chart.render();
}
});
});
我的JSON文件:
{
"dataset": [{
"seriesname": "Topic 22",
"data": [{
"value": 0
}, {
"value": 1
}, {
"value": 0
}, {
"value": 0
}, {
"value": 0
}]
}]
}
我想显示值参数,但在使用上面的代码时没有显示。
答案 0 :(得分:0)
您使用的格式错误, class Login extends Blah implement Blah {
private loginInt;
private int getLoginInt() {
return loginInt;
}
}
接受如下数据:
highcharts
但是您将整个data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
传递给了数据。所以,你应该只获得价值,你可以这样做:
JSON

var obj = {
"dataset": [{
"seriesname": "Topic 22",
"data": [{
"value": 0
}, {
"value": 1
}, {
"value": 0
}, {
"value": 0
}, {
"value": 0
}]
}]
};
var array = [];
$.each(obj.dataset[0].data,function(i,v){
array.push(obj.dataset[0].data[i].value);
});
console.log(array);

现在将值传递给数据:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>