-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ConditionalFormatting): allow inverse color scaling and add color picker #20353
feat(ConditionalFormatting): allow inverse color scaling and add color picker #20353
Conversation
The hexToRGBString function might be useful elsewhere, so please let me know if there's a good place to move it. |
Codecov Report
@@ Coverage Diff @@
## master #20353 +/- ##
=======================================
Coverage 66.71% 66.71%
=======================================
Files 1739 1739
Lines 65149 65190 +41
Branches 6899 6919 +20
=======================================
+ Hits 43462 43493 +31
- Misses 19934 19939 +5
- Partials 1753 1758 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @stevetracvc and for adding tests! I left some comments.
superset-frontend/packages/superset-ui-chart-controls/test/utils/getColorFormatters.test.ts
Outdated
Show resolved
Hide resolved
...nd/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx
Outdated
Show resolved
Hide resolved
...c/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.test.tsx
Outdated
Show resolved
Hide resolved
...nd/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx
Outdated
Show resolved
Hide resolved
Love the change with color picker!
Screen.Recording.2022-06-14.at.15.44.03.mov |
superset-frontend/packages/superset-ui-chart-controls/src/types.ts
Outdated
Show resolved
Hide resolved
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts
Outdated
Show resolved
Hide resolved
@@ -26,10 +26,12 @@ import ControlHeader from '../ControlHeader'; | |||
const propTypes = { | |||
onChange: PropTypes.func, | |||
value: PropTypes.object, | |||
sketchPickerWidth: PropTypes.number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if you'd rather just hard code in a bigger width, rather than having it as a prop
there are a lot of issues associated with moving away from color strings like `rgb(255, 255, 255)` in favor of `#FFFFFF` (and similar with alpha values). This fixes a lot of the issues presented, and also provides some extra functions to help with the transition. Unfortunately there are still too many other components that are using these rgb strings to convert the color picker right now.
switching from colors stored as 'rgb(r, g, b)' to hex strings is going to affect a lot of different parts of the code |
Hey @stevetracvc @kgabryje @michael-s-molina - it looks like this effort fell by the wayside somehow. Is there any interest in rekindling/rebasing this effort to get it across the finish line? |
@rusackas I'd love to, not sure how much work it'll be. I'm still running v2.0.x something, and I haven't had a chance to play with any of the newer updates. I don't think I'll be able to look at it till March though. I'll have to see what you all did with the colors themselves, since I know there was a weird transition period between rgb objects and hex strings. |
Cool... I'll just set this to Draft mode for now then, and hit us up here or on Slack if you want to catch up on things when the time comes. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20353 +/- ##
=======================================
Coverage 66.71% 66.71%
=======================================
Files 1739 1739
Lines 65149 65190 +41
Branches 6899 6919 +20
=======================================
+ Hits 43462 43493 +31
- Misses 19934 19939 +5
- Partials 1753 1758 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@stevetracvc Since this still seems to be accumulating conflicts and whatnot, I'll go ahead and close it. Please feel free to reopen it if you ever want to rekindle this effort. Thanks! |
SUMMARY
Currently, for the conditional color scaling, alpha is directly proportional to the value. This PR adds a checkbox to the Conditional Formatting modal that allows the designer to invert this scale, ie, as the value increases, the alpha decreases
Additionally, this fixes an issue I noticed with #20016 that broke the conditional formatting feature (need to convert hex string to 'rgb(R,G,B)' string).
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Broken color formatting:
![broken](https://user-images.githubusercontent.com/70416691/173202836-c3465070-1a93-4562-88b4-86b73ac7642b.png)
Regular conditional formatting:
![regular](https://user-images.githubusercontent.com/70416691/173202684-276f4ca1-eb7d-46cd-adf8-60d21eeb5dc7.png)
Inverted for Rank
![inverted](https://user-images.githubusercontent.com/70416691/173202690-4b23768a-df06-4edb-b8e5-7a6995d8658a.png)
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION