-
Notifications
You must be signed in to change notification settings - Fork 16.2k
fix: Last Month Label Missing on X-Axis in Time Series Line Charts #36085
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: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -525,7 +525,7 @@ export default function transformProps( | |
| nameGap: convertInteger(xAxisTitleMargin), | ||
| nameLocation: 'middle', | ||
| axisLabel: { | ||
| hideOverlap: true, | ||
| hideOverlap: xAxisType !== AxisType.Time, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary computation in hideOverlap property
Tell me moreWhat is the issue?The hideOverlap property is being computed on every render by comparing xAxisType to AxisType.Time, which is an unnecessary computation since these values don't change during the component lifecycle. Why this mattersThis creates a minor performance overhead as the comparison is executed on every function call, even though the result will be the same for a given xAxisType value throughout the component's lifecycle. Suggested change ∙ Feature PreviewPre-compute the boolean value and store it in a variable before the xAxis object definition: const shouldHideOverlap = xAxisType !== AxisType.Time;
let xAxis: any = {
type: xAxisType,
name: xAxisTitle,
nameGap: convertInteger(xAxisTitleMargin),
nameLocation: 'middle',
axisLabel: {
hideOverlap: shouldHideOverlap,
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
interval: xAxisLabelInterval,
},
// ... rest of config
};Provide feedback to improve future suggestions💬 Looking for more details? Reply to this comment to chat with Korbit. |
||
| formatter: xAxisFormatter, | ||
| rotate: xAxisLabelRotation, | ||
| interval: xAxisLabelInterval, | ||
|
|
||
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.
Time axis label overlap not prevented
Tell me more
What is the issue?
The conditional logic for hideOverlap may cause label overlap issues for time-based charts where labels could still overlap despite being disabled.
Why this matters
When xAxisType is AxisType.Time, hideOverlap will be set to false, which means overlapping labels will be displayed. This could result in unreadable or cluttered time axis labels, especially when there are many data points or long time labels that naturally overlap.
Suggested change ∙ Feature Preview
Consider the specific use case requirements. If time labels should never overlap, keep
hideOverlap: truefor all axis types. If time labels need to show all values even when overlapping, consider adding additional logic to handle label formatting or rotation:Or implement proper label spacing/rotation for time axes to prevent overlap while showing all labels.
Provide feedback to improve future suggestions
💬 Looking for more details? Reply to this comment to chat with Korbit.