You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mohammadqassim12 (via GitHub)" <gi...@apache.org> on 2025/11/26 01:09:24 UTC

[PR] feat(table): Gradient Toggle [superset]

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

   ### SUMMARY
   This PR adds a **"Use gradient"** toggle to the table chart’s conditional formatting configuration.
   
   Previously, conditional formatting always rendered colors using a gradient (via varying opacity). With this change, users can explicitly choose between:
   
   - **Gradient mode** (current behavior): apply a color gradient by varying opacity based on the metric value.
   - **Solid mode** (new behavior): render all formatted cells using the selected color at full opacity.
   
   This gives users finer control over the visual styling of conditional formatting, especially in cases where gradients can be visually noisy or conflict with existing themes.
   
   Key changes:
   - Extend `ConditionalFormattingConfig` with a `useGradient` flag.
   - Update the color computation logic (`getColorFunction`) to respect `useGradient` and fall back to solid colors when disabled.
   - Add a **"Use gradient"** checkbox to the `FormattingPopoverContent` UI.
   - Default `useGradient` to `true` for backward compatibility with existing saved charts and dashboards.
   
   ### AFTER SCREENSHOTS
   <img width="3024" height="1964" alt="image" src="https://github.com/user-attachments/assets/4c07d4bd-652d-4e52-9209-f30bb8afb306" />
   
   <img width="3024" height="1964" alt="image" src="https://github.com/user-attachments/assets/cf8f3c93-3da6-4405-ae99-27b3e6ba73ea" />
   
   ### TESTING INSTRUCTIONS
   1. **Basic UI behavior**
      1. Create or open a **Table** chart.
      2. Open the **Customize** / **Conditional formatting** panel.
      3. Confirm that a **"Use gradient"** checkbox is visible in the formatting popover.
      4. Ensure the checkbox is **checked by default** for:
         - Newly created conditional formatting rules.
         - Existing charts with conditional formatting.
   
   2. **Gradient mode (backward compatibility)**
      1. With **"Use gradient"** checked:
         - Apply a conditional formatting rule on a numeric column.
         - Verify that cell colors are rendered using varying opacity (gradient behavior).
         - Confirm that existing dashboards continue to look the same as before.
   
   3. **Solid mode behavior**
      1. Uncheck **"Use gradient"** for a conditional formatting rule.
      2. Apply the rule and run the query.
      3. Verify that formatted cells are rendered with **solid colors** (full opacity).
      4. Toggle the checkbox on/off and confirm the visual changes update accordingly.
   
   Automated Tests: 
   - `cd superset-frontend && npm run test`
   - Run specific unit tests added in this pr: 
   `npm run test -- getColorFormatters && npm run test -- TableChart && npm run test -- FormattingPopoverContent `
   
   ### 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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "mohammadqassim12 (via GitHub)" <gi...@apache.org>.
mohammadqassim12 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3604602052

   Hey @rusackas , thank you so much for your time. I went ahead and resolved the merge conflict and I think its good to go!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "mohammadqassim12 (via GitHub)" <gi...@apache.org>.
mohammadqassim12 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3593823635

   Fixed the failing pre-commit check (missing newline at end of file). CI should pass now.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3578304309

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "SBIN2010 (via GitHub)" <gi...@apache.org>.
SBIN2010 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3593587066

   Running CI 🤞


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "mohammadqassim12 (via GitHub)" <gi...@apache.org>.
mohammadqassim12 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3613912635

   Thank you @SBIN2010 for running the CI and helping me keep this PR updated!
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3613569572

   Oh my, new conflicts have arisen! I'll try again to merge once that's sorted out. Thanks for sticking with it :D 
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3613678270

   CodeAnt AI is running Incremental review


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #36280:
URL: https://github.com/apache/superset/pull/36280


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3604603046

   CodeAnt AI finished reviewing your PR.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3604590389

   CodeAnt AI is reviewing your PR.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "SBIN2010 (via GitHub)" <gi...@apache.org>.
SBIN2010 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3613748550

   Running CI 🤞


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3598174130

   @SBIN2010 CI is passing now... how's it look to you?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(table): Gradient Toggle [superset]

Posted by "mohammadqassim12 (via GitHub)" <gi...@apache.org>.
mohammadqassim12 commented on PR #36280:
URL: https://github.com/apache/superset/pull/36280#issuecomment-3613682324

   Hey @rusackas , I went ahead and resolved the merge conflicts as soon as i got the notification. The branch should be good to go!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org