我有一个组合图(堆栈列和散点图)。我使用stacklabels显示stack列的总输出,但它显示了散点线的值。任何人都可以禁用散线值吗?
谢谢
https://jsfiddle.net/kcsophic/h2c0Lrow/
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
min: 0,
stackLabels: {
enabled: true,
align: 'center',
style: {
color:'#FFF'
},
},
title: {
text: 'Total fruit consumption'
},
plotLines: [{
color: '#0520ed',
width: 4,
value: 12,
zIndex: 4,
label: {
text: 'Target = ',
style: {
color:'#FFF'
},
align: 'right',
rotation: 90,
x: 5,
y: 25
}
}]
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
},{
name: 'Target Line',
type: 'scatter',
showInLegend: false,
marker: {
enabled: false
},
data: [19],
enableMouseTracking: false
}]
});
您应该简单地禁用散点图系列的堆叠:
series: [..., {
...,
stacking: false,
type: 'scatter'
}]
实时演示: https://jsfiddle.net/BlackLabel/473vs1ny/
API参考: https://api.highcharts.com/highcharts/series.scatter.stacking