消除 Highchart Bulletchart 中一系列值末尾的差距?
Eliminate the gap at the end of a range of values in Highchart Bulletchart?
我想将最后一个绘图带值(225) 显示为x 中的最大值axis.In 图片你可以看到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参考:
我想将最后一个绘图带值(225) 显示为x 中的最大值axis.In 图片你可以看到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参考: