bikash-barnwal opened a new pull request, #43189:
URL: https://github.com/apache/superset/pull/43189

   ### SUMMARY
   
   Gantt chart category names are cut off on the left.
   
   They are not axis labels — they are rendered as `markLine` labels anchored 
to the start of the grid (`Gantt/transformProps.ts`, `position: 'start'`, 
`formatter: '{b}'`). `grid.containLabel` only reserves space for *axis* labels, 
so a category name wider than the default left padding gets drawn into the plot 
area and clipped by the chart edge.
   
   The fix measures the widest category name and adds it to the grid's left 
padding, capped at a quarter of the chart width so one very long category 
cannot eat the plot. The label is given that same width with `overflow: 
'truncate'`, so anything past the cap ends in an ellipsis instead of 
overflowing whatever was reserved.
   
   The text measurement already existed for legend layout, canvas-based with a 
cache and a character-width fallback when there is no `document`. It is renamed 
`measureLegendTextWidth` → `measureTextWidth` and exported, since it is no 
longer legend-specific; the cache constant is renamed to match. No behavior 
change for the legend.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: long category names truncated by the plot edge with no ellipsis, 
some unreadable.
   After: the grid shifts right to fit the names; names beyond 25% of chart 
width end in an ellipsis.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm run test -- plugins/plugin-chart-echarts/test
   ```
   
   **773 tests across 69 suites pass** (the whole echarts plugin, since the 
shared measurement helper was touched). The new test asserts that a long 
category reserves more left padding than a short one, that the label truncates, 
and that the reserved width stays within the 25% cap.
   
   One existing expectation in `Gantt/transformProps.test.ts` was updated: its 
exhaustive `toEqual` on the category `markLine` series now includes the new 
`width` / `overflow` label fields.
   
   Manually: build a Gantt chart whose y-axis dimension has long values and 
confirm the names render fully rather than clipped.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #38844
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to