我想显示我遵循此示例https://www.highcharts.com/demo/column-basic的高图表类型列 就我而言,数据是从数据库
获取的
var id = $("input[id='id1']:checked").val();
getAjaxData(id);
//});
var opt = {
chart: {
renderTo: 'container4',
type: 'column'
},
title: {
text: 'abc',
x: -20 //center
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'Millions'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
pointFormat: '<span style="color:{point.color}">{point.name}</span>:<b>{point.y}</b> of total<br/>'
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y}'
}
}
},
legend: {
itemStyle: {
fontSize:'10px'
},
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
series: []
};
function getAjaxData(id) {
$.getJSON("file.php", {id: id},function(json) {
opt.xAxis.categories = json[0]['data'];
opt.series[0] = json[1];
opt.series[1] = json[2];
chart = new Highcharts.Chart(opt);
});
}
我想同时显示两列。但是这里只显示一列。其他显示(如果显示的列已关闭)。显示或php文件有问题吗?如果是的话,我也会提供它