-
Notifications
You must be signed in to change notification settings - Fork 14.9k
fix(charts): show all x-axis date labels #33191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.1
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
Unbounded splitNumber causing potential performance and readability issues ▹ view | 🧠 Not in standard |
Files scanned
File Path | Reviewed |
---|---|
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
@@ -488,6 +488,7 @@ export default function transformProps( | |||
formatter: xAxisFormatter, | |||
rotate: xAxisLabelRotation, | |||
}, | |||
splitNumber: data.length, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @magickspell, this looks great! What happens when you choose day or minute as the time grain? Does it still try to render every x-axis label, or will it then aggregate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should have a checkbox control to enable this. I'm a little worried that even with larger timegrains, the labels might overlap when they're in the default (horizontal) layout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the checkbox (preferably disabled by default to preserve existing functionality)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
splitNumber does not guarantee that all labels will be displayed.
Note that this number serves only as a recommendation, and the true segments may be adjusted based on readability.
You need to set interval, min, and max to achieve this functionality.
As splitNumber is a recommendation value, the calculated tick may not be the same as expected. In this case, interval should be used along with min and max to compulsively set tickings.
I also agree with the checkbox (disabled by default) approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUMMARY
Fix to display all x-axis date labels that are selected in the time grain.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
Expect: All months should be displayed on the X-AXIS.
ADDITIONAL INFORMATION