Automatically rotate x-axis labels for ordinal x-axes
See original GitHub issueDescription: What is it?
For x-axes that are strings (ordinal values) we should rotate the labels 45 degrees once there are too many to display horizontally without overlapping.
Then, once the labels overlap at 45 degrees, we should rotate them to 90 degrees.
Once the 90 degrees values start overlapping, we should show no labels at all.
Problem: What problem does this solve?
When there are too many x-axis values on a chart, then you end up with values that are missing.
This is fine if you’re in Lightdash because you can hover over the values, but if you’re sharing these charts externally, you can’t see the values on the x-axis making the charts illegible (if they’re ordinal values - i.e. not continuous ones like dates or continuous numbers)
What: Roughly, what does this look like in the product?
- The chart has ordinal values on the x-axis (let’s simplify this and just say
string
values) - If the labels are overlapping being horizontal, we shift them to 45 degrees
- If the labels are overlapping at 45 degrees, we shift them to 90 degrees
- If the labels are overlapping at 90 degrees, we remove the labels
Issue Analytics
- State:
- Created a year ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
xAxis.labels.autoRotation | highstock API Reference
For horizontal axes, the allowed degrees of label rotation to prevent overlapping labels. If there is enough space, labels are not rotated.
Read more >Formatting the Axis Labels
For information, see Controlling Automatic Layout of Ordinal Axis Labels. ... Note that to format x-axis labels in a bubble or scatter chart,...
Read more >HIGHCHARTS auto-rotate x-axis labels for custom ...
You can use xAxis.labels.rotation to change the auto-rotation labels and adjust the rotation to the responsive design rules responsive.rules.
Read more >Adjusting the appearance of the scale labels
Hiding and rotating labels. For the x-axis it is common to rotate the label to better fit long text labels. This is done...
Read more >axisLabel.autoRotate · Issue #14996 · apache/echarts
If the axis labels do not fit, then autoRotate will automatically calculate ... Automatically rotate x-axis labels for ordinal x-axes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is a echarts ticket for this feature request
Suggest that you make this an option that is configurable by the user: Horizontal, angled 45 degrees right, left, vertical. Note that not all columns need labels, especially for time series.