question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically rotate x-axis labels for ordinal x-axes

See original GitHub issue

Description: 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. image

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:open
  • Created a year ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ZeRegocommented, Jun 16, 2022
1reaction
JohnRomanskicommented, May 27, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found