Automatic axis label rotation and skip calculation
A few suggestions describe part of functionality needed already. It would be extremely useful for Highcharts to automatically calculate when x-axis or y-axis labels need to be rotated or skipped to prevent overlapping. Configuration would have the following options:
preventOverlap: { false / ['rotate', 'skip', 'multiLine'] }, where false turns it off and an array gives a preference order which method to apply first; rotate rotates until full and then applies skip, skip calculates how many labels can be used out of total and multiLine spaces odd or even labels onto multiple lines.
Automatic label rotation is implemented as of Highcharts 4.1. See http://api.highcharts.com/highcharts#xAxis.labels.autoRotation.
-
Jenish Tailor: Yes, step is by default automatically calculated to prevent overlap. In the event of e.g. a category axis where step is always 1, the labels are by default rotated to prevent overlap. If this is not enough, the labels are shortened by ellipsis. If there is still overlap, Highcharts will remove individual labels to prevent overlap.
-
Jenish Tailor commented
I wonder if Highcharts has automatic step calculation now ?
-
kzoon commented
automatic step calculation: Yes!
Se for instance this chart: http://jsfiddle.net/kzoon/34Vfw/September and November are not rendered due to a lack of space. This is quite ugly, because it cause random gaps in the axis labels.
I would expect one of these two things to happen:
* Render September and December, but break off to prevent overlap with the next label
* Automatically set step to 2, so that every second label is renderedDue to my requirements I can't use the following solutions:
* Set maxStaggerlines to 2 or higher
* Set labels step to 2 or higher manually -
Hans Wijnveen commented
This would be a very good feature! The new staggerline function is helpful, but does not always prevent overlap. Automatically setting the "Step" to a higher value in order to prevent overlap would be fine as far as I'm concerned.