sadpandajoe opened a new issue, #44466:
URL: https://github.com/apache/superset/issues/44466

   ### Bug description
   
   Follow-up to #38037. The chart configuration described there (stacked 
ECharts Bar chart, "Show Value" enabled, mostly small values plus one very 
large-magnitude outlier in the same series) produces value labels that collide 
and overlap on the small-but-non-zero segments, rendering an illegible garbled 
cluster of text instead of readable per-segment values.
   
   This is **distinct** from two already-fixed, related defects, which I 
confirmed do not cover this case:
   - #42702 / fixed by #43178 — only suppresses labels when a segment's value 
is *exactly* `0` (`numericValue === 0`). It does not help here: the small 
values in this repro (e.g. `-1` to `-5`) are non-zero, so they are not 
filtered, but their rendered height is still sub-pixel next to the outlier.
   - #43144 — added a fit-aware legibility floor (`MIN_LABEL_SEGMENT_SIZE_PX`), 
but only for the opt-in **Auto** value-label position (`isAutoBarLabel`). The 
shipped **default** position (`Outside End`) has no such guard.
   
   ### Reproduction
   
   1. Create a dataset with mostly small values in one range (e.g. `-1` to 
`-5`) and one large-magnitude outlier in the same series (e.g. `-4,000,000`) — 
see the CSV attached to #38037 for a working example (50 rows × 3 stacked 
series).
   2. Create an ECharts Bar Chart, Stacked, with "Show Value" enabled and a 
currency/number format applied.
   3. Render the chart (horizontal or vertical orientation).
   
   **Observed:** the small-magnitude segments render at sub-pixel height/width 
next to the outlier's segment. Their value labels are still drawn (they're 
non-zero, so the zero-value guard from #43178 doesn't apply) but land at 
nearly-identical coordinates and visually collide/overlap, producing garbled, 
unreadable text.
   
   **Expected:** either the labels are omitted on segments too small to legibly 
display them (matching the behavior `Auto` position already gets via 
`MIN_LABEL_SEGMENT_SIZE_PX`), or they are laid out to avoid collision.
   
   ### Technical detail
   
   Verified via a headless ECharts (6.1.0) render of the reproduction data (50 
rows × 3 stacked series), independent of the browser:
   - 145–149 of 150 rendered labels have a colliding neighbor (near-identical 
bounding box).
   - 24 groups of labels are drawn at byte-identical `(x, y)` coordinates.
   - Reproduces identically on current `master` and on the pre-#38695 code — 
this is not related to the (separate, already-fixed) horizontal-clipping 
symptom originally reported in #38037.
   
   Root cause: 
`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts`.
 The `MIN_LABEL_SEGMENT_SIZE_PX` legibility-floor guard (lines 86, 163) is only 
reachable through the `labelLayout` callback, which is gated behind 
`isAutoBarLabel` / the opt-in `Auto` value-label position (lines 568, 609). The 
shipped default (`BarValueLabelPosition.OutsideEnd`) resolves with no 
`labelLayout` callback at all (see 
`test/Timeseries/transformers.test.ts:424-443`), so nothing suppresses or 
repositions colliding labels for users who haven't opted into `Auto`.
   
   ### Suggested fix
   
   Extend the existing `MIN_LABEL_SEGMENT_SIZE_PX` legibility-floor guard to 
every `plotType === 'bar'` label, not only when `isAutoBarLabel` is true — 
reusing the helper `#43144` already added, scoped to bar charts only, so 
segments too small to legibly display a label are blanked instead of left to 
collide.
   
   ### Superset version
   
   master / latest-dev
   
   ### Additional context
   
   Found during automated investigation of #38037 by Agor/Ultraset; PR 
referencing #38037's originally-reported symptom is already fixed on master via 
#38695 (unrelated change, side effect). This issue tracks only the residual 
label-collision defect, which is confirmed still live on current master.
   


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