Shanto Siddiq
Shanto Siddiq

Reputation: 153

Eliminate the gap at the end of a range of values in Highchart Bulletchart?

I want to show the last plot band value(225) as the max value in x axis.In the picture you can see the x axis max value is 300, that's why a gap is created. I want to show the plotband max value 225 as the max value in x axis. So the gap will eliminate. 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

Upvotes: 0

Views: 227

Answers (1)

ppotaczek
ppotaczek

Reputation: 39099

You need to set the max property and disable the endOnTick option:

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

Live demo: https://jsfiddle.net/BlackLabel/je7ocpnh/

API Reference:

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

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

Upvotes: 1

Related Questions