rusackas opened a new pull request, #42610:
URL: https://github.com/apache/superset/pull/42610

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   In a horizontal, stacked, row-contribution (100%) bar chart, some segments 
could vanish from the render entirely even though the underlying percentages 
were correct and summed to 100%.
   
   The row-contribution axis max was hard-coded to exactly `1`. Contribution 
shares are normalized so a stacked row is supposed to sum to `1`, but floating 
point rounding can push the actual stacked total fractionally above `1` (e.g. 
`1.0000000000000002`). When that happens, capping the axis max at exactly `1` 
causes echarts to clip the topmost stacked segment entirely on the swapped axis 
used for horizontal bars, instead of just rounding the pixel width. This lines 
up with the community's own workaround of nudging "Truncate Y Axis" max to 
`1.00001`, which happened to sidestep the same edge case.
   
   This PR pads the axis max up to the actual stacked total when it exceeds 
`1`, so no segment gets clipped, while leaving the `0`-`1` default in place for 
the (much more common) case where the total is exactly `1` or below.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A — this is a floating point edge case in axis-bounds calculation; see the 
reproduction and screenshots already on the issue.
   
   ### TESTING INSTRUCTIONS
   1. Build a horizontal, stacked bar chart with contribution mode = Row over a 
dataset with several small groupby segments per category, using the SQL repro 
attached to #30914.
   2. Reload the chart a few times; before this fix, the same segment goes 
missing on certain categories on every load. After the fix, all segments render.
   3. `pytest`-equivalent for the frontend: `npm run test -- 
plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts` — new test 
`should not clip small segments when row-contribution percentages float above 1 
in horizontal stacked bar charts` pins the regression.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #30914
   - [ ] 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