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