我希望能够在我的分组(时间/优先级)之间切换。我有一个堆叠的柱状图。有一个选项可以这样做,example。但是它似乎只能与表中已有的数据一起使用,并且我将把我的数据作为JSON引入。
我的javascript是:
var chart_ops_support_times = new Highcharts.Chart({
chart: {
renderTo: 'chart_ops_support_times',
type: 'column'
},
title: {
text: '',
align: 'left'
},
subtitle: {
text: ' '
},
xAxis: {
categories: [
'one hour','2 hours','4 hours',
'8 hours','one day','2 days',
'one week','> one week'
]
},
yAxis: {
min: 0,
title: {
text: 'counts'
}
},
legend: {
align: 'left',
verticalAlign: 'top',
floating: true,
borderColor: '#CCC',
borderWidth: 1,
shadow: false,
symbolHeight: 10,
symbolWidth: 10
},
tooltip: {
formatter: function () {
return "<b>" + this.x + "</b><br/>" +
this.series.name + ': ' + this.y + "<br/>" +
'Total: ' + this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal'
}
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
series: data
});发布于 2015-08-31 23:09:03
数据模块不能与JSON一起工作。
数据模块提供了从外部源加载数据的选项,这些外部源包括CSV文件、超文本标记语言表格或Google电子表格,使用声明性选项集。(http://www.highcharts.com/docs/working-with-data/data-module)
您可以解析JSON中的数据,以某种方式使用,而不是使用数据模块。
另一种选择是使用JSON中的数据创建隐藏的HTML表,然后使用带有数据模块的Highcharts和使用表。
https://stackoverflow.com/questions/32280168
复制相似问题