michael-s-molina opened a new pull request, #39012:
URL: https://github.com/apache/superset/pull/39012

   ## SUMMARY
   
   Fixes two related bugs in the ECharts horizontal stacked bar chart 
(`echarts_timeseries_bar` with horizontal orientation and `truncateYAxis` 
enabled):
   
   1. **Bars appear not stacked** — stacked bars beyond the individual series 
max were clipped, making the chart look like bars were rendering individually 
rather than stacked.
   2. **Duplicate x-axis labels** — with an artificially low `xAxis.max`, 
ECharts generated ticks at sub-integer intervals (e.g. 0.5 steps), and the 
integer formatter produced labels like `1 2 2 3 3 4 4`.
   
   ### Root cause
   
   `shouldCalculateDataBounds` computes `yAxisMax` from individual per-series 
values (`dataMax`). For a stacked chart this is incorrect — the axis maximum 
must accommodate the *stacked total* per row, not any single series value.
   
   **Example**: with series `High=2`, `Low=2`, `Medium=4`, `dataMax=4` but the 
stacked total is `8`. Setting `xAxis.max=4` clips bars at half their height and 
produces a cramped axis range that triggers duplicate tick labels.
   
   ### Fix
   
   When `stack` is truthy, use the max of `sortedTotalValues` (per-row stacked 
totals already computed by `extractSeries`) as the effective axis max instead 
of `dataMax`.
   
   Additionally, guard the `stackDimension` series assignment to skip 
`undefined` dimension values, preventing accidental overwrite of the `stack` 
property with `undefined`.
   
   Fixes https://github.com/apache/superset/issues/38989
   Fixes https://github.com/apache/superset/issues/38988
   
   ## BEFORE / AFTER
   
   <img width="667" height="380" alt="Screenshot 2026-04-01 at 15 20 05" 
src="https://github.com/user-attachments/assets/eeef4edf-1820-47f8-95b7-e029c2d183ed";
 />
   
   <img width="635" height="336" alt="Screenshot 2026-04-01 at 15 20 17" 
src="https://github.com/user-attachments/assets/bae31633-1243-46bd-92b9-1b87e460c78e";
 />
   
   ## TESTING INSTRUCTIONS
   
   1. Create a horizontal bar chart (`echarts_timeseries_bar`, orientation = 
Horizontal) with multiple metrics and `Stack` enabled.
   2. Enable `Truncate Y Axis` (or set y-axis bounds).
   3. Verify bars stack correctly to their full combined height.
   4. Verify x-axis labels show clean integer ticks without duplicates.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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
   


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