[javascript] How to get highcharts dates in the x axis?

Is there a standard way to get dates on the x-axis for Highcharts? Can't find it in their documentation: http://www.highcharts.com/ref/#xAxis--type

When my time range is large enough, it shows dates. However, when the time range isn't large enough, it just shows hours, like this:

enter image description here

This is less than ideal... if it could show a date and time in this case, that'd be great. Anyone know how?

This question is related to javascript highcharts

The answer is


You write like this-:

xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
           day: '%d %b %Y'    //ex- 01 Jan 2016
        }
}

also check for other datetime format

http://api.highcharts.com/highcharts#xAxis.dateTimeLabelFormats


Check this sample out from the Highcharts API.

Replace this

return Highcharts.dateFormat('%a %d %b', this.value);

With this

return Highcharts.dateFormat('%a %d %b %H:%M:%S', this.value);

Look here about the dateFormat() function.

Also see - tickInterval and pointInterval