Autorotate x axis tick texts on types "category" and "timeseries"
See original GitHub issueDescription
I would like to have an option for autorotating x axis tick texts on type “category” if there isn’t enough space to fit them between 2 ticks. Main reason for autorotating x axis tick texts is saving unused space in the chart.
It should autorotate if:
axis_x_tick_multiline === false
axis_x_tick_autorotate === true
axis_x_tick_rotate !== 0
- longest text width > space between 2 ticks
- Check 1-4 on resize/redraw
It also improves the appereance of the x axis if:
- the texts are too long and there is less space between 2 ticks or
- there are many elements on x axis
Examples:
-
There is enough space so the texts aren’t rotated:
-
There is not enough space so the texts are rotated:
-
There is not enough space for 1 text so all texts are rotated:
-
There are many elements on x axis:
Would this feature be useful enough to implement it in billboard or perhaps as a plugin? If needed, this feature could be expanded and implemented for other axis types in the future.
What do you think about it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to rotate x-axis tick labels in a pandas plot - Stack Overflow
Pass param rot=0 to rotate the xticklabels: import matplotlib matplotlib.style.use('ggplot') import matplotlib.pyplot as plt import pandas as pd df = pd.
Read more >xAxis.labels.rotation | highcharts API Reference
The axis labels show the number or category for each tick. ... When each category width is more than this many pixels, we...
Read more >GGPlot Axis Ticks: Set and Rotate Text Labels - Datanovia
This article describes how to easily set ggplot axis ticks for both x and y axes. We'll also explain how to rotate axis...
Read more >Options - Documentation - UNPKG
The number of x axis ticks to show. This option hides tick lines together with tick text. If this option is used on...
Read more >Format Category (X) Axis Dialog Box - Logi Analytics
Axis Tab; Tick Mark Tab; Font Tab; Orientation Tab; Format Tab; Range Tab; Behaviors Tab. You see these buttons in the tabs: OK....
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
🎉 This issue has been resolved in version 1.12.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
I worked on this issue in the last few days. As the code changes are not minimal and autorotating could be used frequently, I implemented it in the core.
autorotate without y2 axis shown
autorotate with y2 axis shown
It resizes the x axis height if you hide all elements in the chart, which looks better instead of displaying empty space. This change also works for all three x axis types.
Autorotating works only if:
false
false
(because some issues with calculating the y2 axis overflow when texts are hidden)category
Y2 axis overflow will be calculated if:
false
false
category
0 < value < 90
If you are ok with this changes, I can make a pull request for all of them. If there is something to clarify beforehand, we can do it before or within the pull request.
PS: As of some internet problems during writing this comment, I somehow closed and reopened the post, don’t ask me how 😄