Repository navigation
fix(echarts): keep forced x-axis boundary labels from overlapping and… - #45850
PrakharAgarwal17 wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #45850 +/- ##
=======================================
Coverage 84.69% 84.69%
=======================================
Files 3069 3069
Lines 205489 205573 +84
Branches 48314 48361 +47
=======================================
+ Hits 174035 174119 +84
Misses 28164 28164
Partials 3290 3290
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@sadpandajoe are we ok to merge? This one is going into 7.0.0rc3 |
| TIMESERIES_CONSTANTS.xAxisLabelMinGapPx | ||
| ((domainMin !== undefined && | ||
| domainMax !== undefined && | ||
| value >= domainMin && |
There was a problem hiding this comment.
domainMin/domainMax and pixelsPerMs are fixed to the full data extent when the formatter is built, so after a zoom the reservation still protects boundary labels that are no longer on screen. Example: daily data Jan 1 2026–Jan 1 2027, 400px plot, %Y-%m-%d; zoom to Jan 10–Mar 1. Jan 10 is ~9px from domainMin in full-domain scale, well under the reserved boundary width, so every visible tick (including both zoom edges) formats to '' and the axis is blank, where before it kept Jan 10. Should the reservation be skipped (or computed from the visible extent) when the boundary label isn't within the zoomed range?
There was a problem hiding this comment.
Thanks for pointing out , I'll look into this issue and try to reproduce it locally first then fix it
There was a problem hiding this comment.
This still reproduces at the current head: ECharts keeps calling this same formatter for the zoomed ticks, so with daily data Jan 1 2026–Jan 1 2027, a 400px plot and %Y-%m-%d, zooming to Jan 10–Mar 1 returns '' for all 10 visible ticks, because the reserved width belongs to the off-screen full-range boundary labels. Could the reservation apply only when a boundary is actually in view, or be skipped once dataZoom narrows the range? A test that dispatches a dataZoom to a sub-range and asserts the visible labels are not all empty would pin it.
There was a problem hiding this comment.
Thanks for the detailed reproduction. The formatter now uses the visible axis extent and actual plot width, so off-screen boundaries no longer reserve space after zooming.
I also added a regression test using a real ECharts dataZoom action for the exact 400px, Jan 10–Mar 1 case. It checks the rendered endpoint labels after zooming, panning, and resetting. The test passes locally.
| Math.max(width - 2 * TIMESERIES_CONSTANTS.gridOffsetLeft, 0), | ||
| Math.max(width - padding.left - padding.right, 0), | ||
| showAllLabels, | ||
| getTooltipTimeFormatter(boundaryTimeFormat, resolvedTimeGrain), |
There was a problem hiding this comment.
On a narrow chart the two full-date boundary labels can now collide: a 180px-wide Day-grain chart spanning Mar 5 2014–Aug 17 2026 renders Wed 5 Mar 2014 and Mon 17 Aug 2026 overlapping by roughly 69px (before this change the short Wed 05 / Mon 17 stayed separate), and the spacing check never blanks a boundary label while hideOverlap is off. Should the full-date format fall back to the short one when both boundary labels don't fit in the plot width?
There was a problem hiding this comment.
Addressed this as well. When both full-date boundary labels cannot fit on one row, the last label moves to a second row, preserving the standalone date context.
Added a regression test for the exact 180px chart that checks both dates remain inside the canvas without overlapping. Also verified it manually in the browser.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |

SUMMARY
Fixes #45489.
Forced x-axis boundary labels could overlap nearby regular ticks and lacked enough date context with Adaptive formatting.
This change:
Wed 5 Mar 2014andMon 17 Aug 2026.Regression coverage includes both boundaries, repeated formatting passes, exact spacing thresholds, narrow plots, missing or degenerate domains, custom formats, and Day/Date/Hour grains.
Implementation and tests were developed with AI assistance.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
Wed 05lacks month/year context, and2026overlapsMon 17.After: Boundary labels include full date context, and colliding regular ticks are hidden.
TESTING INSTRUCTIONS
2014-03-05to2026-08-17.Automated validation: 217 tests passed across two focused Jest suites, plus scoped pre-commit checks including formatting, lint, and TypeScript checking.
Jest command, run from
superset-frontendin the prepared test environment:ADDITIONAL INFORMATION