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

   ### SUMMARY
   
   In a stacked Timeseries Bar chart with **Values** labels on, a series whose 
value is exactly `0` still rendered a label. A zero-value segment has no 
height, so its label is anchored to the same pixel as the neighboring segment's 
label and the two render on top of each other.
   
   The mechanism is the threshold guard in `transformSeries`:
   
   ```ts
   if (numericValue >= (thresholdValues[dataIndex] || Number.MIN_SAFE_INTEGER)) 
{
   ```
   
   With `percentage_threshold` at its default of `0`, `extractDataTotalValues` 
pushes a per-row threshold of `0` — which is falsy, so the guard degrades to 
`numericValue >= Number.MIN_SAFE_INTEGER` and admits everything, zeros included.
   
   The fix returns an empty label for `numericValue === 0` in that branch. It 
deliberately does *not* use `> 0`: negative stacked values render visible 
segments and are legitimately labeled today, so only the zero case — the one 
with nothing to anchor to — is suppressed. The guard sits after the `!stack` 
early return, so unstacked charts still label zeros as before. 
`MixedTimeseries` shares this code path and is fixed along with it.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: the zero series' `0` label sits on top of the adjacent segment's 
label.
   After: no label is drawn for the zero-height segment; every other label is 
unchanged.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm run test -- plugins/plugin-chart-echarts/test/Timeseries 
plugins/plugin-chart-echarts/test/MixedTimeseries
   ```
   
   (295 tests across 17 suites pass, including the new case.)
   
   Manually:
   
   1. Build a Timeseries Bar chart with a dimension that produces a zero value 
for one series in a given bucket.
   2. Set **Stacked Style** to *Stack*, enable **Show Values**, leave 
**Percentage threshold** at `0`.
   3. Before this change the zero series' label overlaps its neighbor's; after 
it, only visible segments carry labels.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #42702
   - [ ] 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