我想将最后一个绘图带宽值(225)显示为x轴的最大值。在图片中,您可以看到x轴最大值为300,这就是创建间隙的原因。我想将绘图带最大值225显示为x轴的最大值。因此差距将消除。
Highcharts.chart('container1', {
chart: {
marginTop: 20,
width: 225,
height: 80
},
title: {
text: ''
},
xAxis: {
categories: ['<span class="hc-cat-title">Revenue</span><br/>']
},
yAxis: {
plotBands: [{
from: 0,
to: 132,
color: '#666'
}, {
from: 132,
to: 157.7,
color: '#999'
}, {
from: 157.7,
to: 225,
color: '#bbb'
}],
title: null
},
series: [{
data: [{
y: 225,
target: 157.7
}]
}],
tooltip: {
pointFormat: '<b>{point.y}</b> (with target at {point.target})'
}
});
的jsfiddle:Bullet Chart
您需要设置max
属性并禁用endOnTick
选项:
yAxis: {
...,
max: 225,
endOnTick: false
},
现场演示:https://jsfiddle.net/BlackLabel/je7ocpnh/
API参考: