score:1

Accepted answer

You can use setExtremes event callback function and update tick interval based on min and max values.

    xAxis: {
        type: 'datetime',
        events: {
            setExtremes: function(e) {
                const interval = (e.max - e.min) / 6;

                this.update({
                    tickInterval: interval
                }, false);
            }
        }
    }

You can also consider using minTickInterval or tickPixelInterval.


Live demo: http://jsfiddle.net/BlackLabel/d1Lbj9xh/

API Reference:

https://api.highcharts.com/highcharts/xAxis.events.setExtremes

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

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


Related Query

More Query from same tag