消除Highchart Bulletchart中一系列值末尾的差距?

问题描述 投票:0回答:1

我想将最后一个绘图带宽值(225)显示为x轴的最大值。在图片中,您可以看到x轴最大值为300,这就是创建间隙的原因。我想将绘图带最大值225显示为x轴的最大值。因此差距将消除。 enter image description here

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

javascript highcharts bullet-chart
1个回答
1
投票

您需要设置max属性并禁用endOnTick选项:

yAxis: {
    ...,
    max: 225,
    endOnTick: false
},

现场演示:https://jsfiddle.net/BlackLabel/je7ocpnh/

API参考:

https://api.highcharts.com/highcharts/yAxis.max

https://api.highcharts.com/highcharts/yAxis.endOnTick

© www.soinside.com 2019 - 2024. All rights reserved.