Highcharts - xAxis label for each point

Question: "Is there a way to force the xAxis shortcut for each point?"

Basically, I have a time series and I need to label each point with xAxis ... These points can be in any interval.

Highcharts xAxis label every point problem


source to share

1 answer

The value you need to change is "tickInterval" ( http://api.highcharts.com/highcharts#xAxis.tickInterval ).

Assuming the axis is of type 'datetime' and you want an interval of 1 day and the time is in milliseconds, you will need:

xAxis: {
        type: 'datetime',
        tickInterval:60*60*24* 1000,


If you need even more control over the labels, you can provide the tickPosition array or write the tickPositioner function ( http://api.highcharts.com/highcharts#xAxis.tickPositioner ).

In your case, it might be easier to specify the tickPositions parameter, as you can simply loop over your data getting the x-axis values ​​and create an array of datetime values.

    xAxis: {
        tickPositions: [0, 1, 2, 4, 8]




All Articles