gpt4 book ai didi

javascript - Highcharts 并排堆叠比较

转载 作者:行者123 更新时间:2023-12-03 11:57:13 25 4
gpt4 key购买 nike

我在 Highcharts 网站上有一个类似于平均每月降雨量演示的图表:http://www.highcharts.com/demo/column-basic

但我想进一步将每个月的城市数据分成两个相互堆叠的子类别 Fiddle :

$('#Bar1170hMonthly').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Monthly Counts'
},
subtitle: {
text: ''
},
xAxis: {
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
]
},
yAxis: {
min: 0,
title: {
text: 'Counts'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:f} cases</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
//stacking: 'normal',
pointPadding: 0.2,
borderWidth: 0
}
},
series: {
cursor: 'pointer',
point: {
events: {
click: function() {

}
}
}
}

, series: [
{
grouping:true,
name: '2011: 36',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 19]

}, {
name: '2012: 237',
data: [13, 14, 35, 23, 37, 11, 23, 22, 8, 12, 18, 21]

}, {
name: '2013: 360',
data: [43, 23, 35, 18, 44, 23, 35, 24, 23, 31, 25, 36]

},
{
name: '2014: 112',
data: [[7, 8], [1, 2], [1, 2], 32, 9, 0, 0, 0, 0, 0, 0, 0]

}]

});

对于每年的每个月,我想将计数分为两个子类别 a,b 并相互堆叠。这可能吗?

最佳答案

您需要使用stacking:“normal”并为每个堆栈设置stack:“id”,其中id之间必须相差很多。例如:http://jsfiddle.net/7jfcpyo2/4/

 {
stacking: true,
stack: 'B',
name: '2014: 112: stack A',
data: [6, 1, 1, 32, 9, 0, 0, 0, 0, 0, 0, 0]

}, {
stacking: true,
stack: 'B',
name: '2014: 112: stack B',
data: [9, 2, 2, 32, 9, 0, 0, 0, 0, 0, 0, 0]

}

上面的两个系列将相互叠加并干扰任何其他系列。您可以拥有任意数量的堆栈。

关于javascript - Highcharts 并排堆叠比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25555393/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com