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:
This is less than ideal... if it could show a date and time in this case, that'd be great. Anyone know how?
Highcharts will automatically try to find the best format for the current zoom-range. This is done if the xAxis has the type 'datetime'
. Next the unit of the current zoom is calculated, it could be one of:
This unit is then used find a format for the axis labels. The default patterns are:
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%e. %b',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
If you want the day to be part of the "hour"-level labels you should change the dateTimeLabelFormats
option for that level include %d
or %e
.
These are the available patters:
http://api.highcharts.com/highcharts#xAxis.dateTimeLabelFormats