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

   ### SUMMARY
   
   Fixes the conditional-formatting coloring anomaly described in #43084, where 
cells within the same column receive background colors that don't correctly 
reflect their relative magnitude.
   
   **Root cause:** `metricColorFormatters` in `transformProps.ts` computed the 
color scale's min/max ("extremes") from `mainQuery.data`, which only contains 
the raw leaf-level backend query result. Subtotal and grand-total values are 
synthesized separately on the client (`synthesizeAdditiveLevels` / 
`splitGroupingSetsResult`) into a different `data` array — the one that's 
actually rendered — and those values never fed into the color scale calculation.
   
   As a result, a grand-total value large enough to exceed the leaf-level range 
would fall outside the comparator's calibrated bounds and silently receive no 
color, while smaller leaf-level values within range rendered correctly. This is 
visible in the issue's screenshot: `-3.06M` and `-2.67M` (grand-total row) were 
left uncolored while smaller negative values like `-193k` and `-370k` in the 
same columns were correctly highlighted.
   
   **Fix:** build the color formatters from every synthesized rollup level 
(`data.flatMap(level => level.data)`) instead of `mainQuery.data` alone, so the 
scale's extremes account for every value that actually gets rendered — leaf 
rows, subtotals, and grand totals.
   
   ### BEFORE/AFTER
   
   Before: grand-total cells with large magnitudes were skipped by conditional 
formatting while smaller leaf-level cells in the same column were colored (see 
screenshot in #43084).
   
   After: all cells, including subtotals/grand totals, are evaluated against a 
color scale calibrated on the full range of rendered values.
   
   ### TESTING INSTRUCTIONS
   
   - Added a regression test in `transformProps.test.ts`: builds a pivot table 
with a grand total (15) larger than any leaf value (10, 5), and asserts the 
grand total receives a color under a full-range (`Comparator.None`) 
conditional-formatting rule — the exact scenario that silently failed before 
this fix.
   - Full pivot-table plugin suite passes locally: `npm test -- 
plugins/plugin-chart-pivot-table` → 9 suites passed, 109 tests passed.
   
   Note: this PR addresses only the conditional-formatting anomaly (Issue 
#43084, part 1). The row-label-truncation feature request in the same issue is 
a separate concern and is not included here.


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