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

   ### SUMMARY
   Adds optional `minBound` and `maxBound` fields to conditional formatting 
rules. These fields let authors keep a color scale fixed instead of 
recalculating it whenever the data changes.
   
   Today, the scale uses `Math.min` and `Math.max` from the current column. For 
the `Between` family of operators, it uses the values entered by the author. As 
a result, the same rule may produce different colors after applying a filter, 
changing the date range, or loading more rows.
   
   This is Phase 1, diverging min/centre/max palettes and percent-of-total 
bounds will be handled separately in follow-up phases.
   
   The change is implemented in the shared color-scale utility 
(`getColorFormatters.ts`) and conditional-formatting popover 
(`FormattingPopoverContent.tsx`). This makes it available to every chart type 
that already supports conditional formatting—Table, Pivot Table, and Big 
Number—without requiring plugin-specific changes.
   
   ### Design decisions
   
   * Bounds apply only to `None`, `>`, `<`, `≥`, and `≤`. They don’t apply to 
`Equal` or `NotEqual`, which perform exact matches. The `Between` family 
already supports manual bounds through `targetValueLeft` and `targetValueRight`.
   * The UI only shows bounds that affect the selected operator:
   
     * `None`: Min bound and Max bound
     * `>` and `≥`: Max bound
     * `<` and `≤`: Min bound
   
     This avoids showing fields that have no effect but could still prevent the 
user from applying the rule because of cross-field validation.
   * Both fields are optional. Existing charts without fixed bounds continue to 
render exactly as they do today, so no migration is required.
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   - Before
   
https://github.com/user-attachments/assets/e6a8717b-0dbe-4346-9b6c-93e1a725a963
   
   - After
   
https://github.com/user-attachments/assets/83ea4408-cdf8-4c1a-869b-f381589331db
   
   - Before
   <img width="2899" height="1175" alt="before-colored-table" 
src="https://github.com/user-attachments/assets/89e5b28f-2c9a-4a0e-9d89-b7defea1c3fa";
 />
   <img width="2899" height="1175" alt="before-popover" 
src="https://github.com/user-attachments/assets/e72b2475-5721-459d-9f19-ce2828cd9679";
 />
   
   - After
   <img width="2899" height="1175" alt="after-colored-table" 
src="https://github.com/user-attachments/assets/de3cb62c-8bbb-4655-bfac-4c79e1d95b25";
 />
   <img width="2899" height="1175" alt="after-popover-filled" 
src="https://github.com/user-attachments/assets/062a7e57-e5f1-4237-b1a3-edc36ef7e025";
 />
   <img width="2899" height="1175" alt="after-popover-none" 
src="https://github.com/user-attachments/assets/389414fa-a77e-40e6-98ae-b03460c3e8bc";
 />
   
   
   ### TESTING INSTRUCTIONS
   1. Create or open a Table (AG Grid) or Pivot Table (AG Grid) chart with a 
numeric column.
   2. Customize tab → Conditional Formatting → Add new color formatter.
   3. Leave Operator as "None" — Min bound and Max bound both appear (optional).
   4. Set e.g. Min bound = 0, Max bound = a value larger than the column's 
actual max, and Apply.
   5. Confirm the color intensity is now scaled against the fixed range, not 
the data's own min/max (values won't reach full color intensity if they're 
below the manual max).
   6. Switch Operator to `>` or `<` and confirm only the relevant bound (Max or 
Min, respectively) is shown.
   7. Save the chart with no bounds set and confirm it renders unchanged from 
before this PR (backward compatibility).
   
   Automated coverage:
   - `getColorFormatters.test.ts` — 72 tests (5 new, covering manual-bound 
overrides for all 5 affected operators, each using a bound value deliberately 
different from the data's own min/max)
   - `FormattingPopoverContent.test.tsx` — new tests for field visibility per 
operator, cross-field min/max validation, and an onChange round-trip check
   - Full frontend suite: 12,167 passed / 1 pre-existing unrelated failure 
(`AsyncAceEditor/useJsonValidation`, untouched by this branch)
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue: PROD-I-3016 (internal Aha idea, not a GitHub 
issue)
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [x] 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