This is how the chart looks like at the moment:
http://jsfiddle.net/YWLpr/2/
If you see the x axis, you can see Month as well as Year while I want to display just the year.
Surprisingly if you add one more data entry in the series
[Date.UTC(2011,2,31), 11.30]
The x axis auto formats itself and display only the year
e.g. - http://jsfiddle.net/YWLpr/3/
So if there are 7 data points I can see year in the x axis but if there are less than 7 data points I can see month and year which is not what I want. How can I stop this auto formatting and display only the year in x axis for less than 7 data points.
If you resize the chart the zoomlevel will switch from year to month therefor you'll have to add a formatting option for month too:
dateTimeLabelFormats: {
month: '%Y',
year: '%Y'
}
You can always use label.formatter
or label.format
, see: http://jsfiddle.net/PwEnd/14/
Docs: http://api.highcharts.com/highcharts#xAxis.labels.format
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With