score:1

Accepted answer

You can use minPadding and maxPadding properties, but their value is relative to the length of the axis.


You can also define pointRange as 2 and correct ticks by using tickPositions or tickPositioner:

plotOptions: {
    column: {
        stacking: 'normal',
        pointRange: 2,
        pointWidth: 20,
    }
},
xAxis: {
    maxPadding: 0,
    minPadding: 0,
    tickPositions: [0, 1, 2]
},

Live demo: http://jsfiddle.net/BlackLabel/2xdwuah9/


Finally, you can reset default margins and specify min and max for the x-axis:

plotOptions: {
    column: {
        stacking: 'normal',
        pointRange: 0,
        pointWidth: 20,
    }
},
xAxis: {
    maxPadding: 0,
    minPadding: 0,
    min: -1,
    max: 3
},

Live demo: http://jsfiddle.net/BlackLabel/96pw12u0/


API Reference:

https://api.highcharts.com/highcharts/xAxis.minPadding

https://api.highcharts.com/highcharts/series.column.pointRange

https://api.highcharts.com/highcharts/xAxis.tickPositioner

https://api.highcharts.com/highcharts/xAxis.min


Related Articles