【发布时间】:2013-12-29 05:57:03
【问题描述】:
我是将 JSON 对象解析为 highchart 的新手,我想绘制基本条形图。 我已经完成了图表的标题。问题是我想显示的系列没有显示。(计为系列,qpAnswer 为 xAxis)。
这是我的 JSON 数据
[
{
qpQuestion: "Is that a dog?",
qpAnswerId: "1",
qpAnswer: "Yes",
count: "0"
},
{
qpQuestion: "Is that a dog?",
qpAnswerId: "2",
qpAnswer: "No",
count: "0"
},
{
qpQuestion: "Is that a dog?",
qpAnswerId: "3",
qpAnswer: "ok",
count: "0"
}
]
这是我的 JS
var url="sections.php?request=graph";
$.getJSON(url,function(data1){
var options={
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: data1[0].qpQuestion
},
xAxis:{
categories: data1.qpAnswer
title: {
text: 'Answer'
}
},
yAxis: {
min: 0,
title: {
text: 'Answer Count'
}
},
series:data1
};
var chart = new Highcharts.Chart(options);
});
【问题讨论】:
-
我可以帮助您的一件事是能够查看您的 JSON 的外观。如果您使用这里的工具 => json.parser.online.fr。在此处输入您的 JSON,您将更好地了解它的实际外观。
标签: javascript json highcharts