通过一些工作,我认为您可以使用堆叠百分比图表和格式化标签和工具提示来实现您想要的结果(据我所知,您需要在 y 轴上显示值而不是百分比)。
如果你能计算出最大值,你可以这样格式化轴 y 标签:
$(function() {
//calculate somehow the maximum value
var max = 23;
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
labels: {
formatter: function() {
//format axis y labels
return this.value / 100 * max;
}
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
shared: true
},
plotOptions: {
column: {
stacking: 'percent'
}
},
series: [{
name: 'Other',
data: [5, 3, 4, 9, 2],
color: 'gray',
showInLegend:false
}, {
name: 'Jane',
data: [2, 2, 3, 7, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 7, 5]
}]
});
});
演示:https://jsfiddle.net/jjhk0LL8/