如何在highChart中的0位置绘制虚线垂直线



我想要x轴上0位置的虚线。我尝试了以下更改,但它适用于条形边距。

Highcharts.chart('container', {
chart: {
type: 'bar'
},
legend: {
symbolWidth: 80
},
plotOptions: {
series: {
color: '#000000'
},
value:0,
dashStyle: 'Dot',
padding:10
},
series: [{
data: [1, 3, 2, 4, 5, 4, -6, 2, 3, 5, 6],

}, {
data: [2, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4, 5],

}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>

您可以使用plotLines在轴上添加虚线。像这样:

yAxis: {
plotLines: [{
color: '#FF0000',
value: 0,
dashStyle: 'dot',
width: 5
}]
},

此处添加到yAxis以创建一条垂直线:

Highcharts.chart('container', {
chart: {
type: 'bar'
},
legend: {
symbolWidth: 80
},
plotOptions: {
series: {
color: '#000000',
}
},
yAxis: {
plotLines: [{
color: '#FF0000',
value: 0,
dashStyle: 'dot',
width: 5
}]
},
series: [{
data: [1, 3, 2, 4, 5, 4, -6, 2, 3, 5, 6],
}, {
data: [2, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4, 5],
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>

最新更新