-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
fix(Dashboard): Color inconsistency on refreshes and conflicts #27439
Conversation
…o/ch79154/fix-color-inconsistency
…o/ch79154/fix-color-inconsistency
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #27439 +/- ##
==========================================
- Coverage 69.61% 67.34% -2.28%
==========================================
Files 1908 1909 +1
Lines 74543 74649 +106
Branches 8316 8330 +14
==========================================
- Hits 51895 50272 -1623
- Misses 20595 22321 +1726
- Partials 2053 2056 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -84,6 +84,7 @@ These features flags currently default to True and **will be removed in a future | |||
|
|||
[//]: # "PLEASE KEEP THE LIST SORTED ALPHABETICALLY" | |||
|
|||
- AVOID_COLORS_COLLISION |
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.
We might technically need to get consensus on this. @michael-s-molina any problems getting consensus and doing this now, or should we wait until the 5.0 proposals open up?
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.
I think waiting for 5.0 would be a good idea as it allows an orderly evaluation of proposed deprecations. We just need to add a card to the board to remind us to submit the proposal.
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.
@michael-s-molina @rusackas this feature flag introduced a regression, so I don't think it makes sense to discuss depreciation. I am keeping it here and not deleting it for now just because we don't have a breaking window open. Thoughts?
@geido would it be possible to add a brief description of the mechanics of the changes in this PR? This would help grasp the chosen approach without having to dive directly into the diff. |
* @param currentColor | ||
* @returns the least used color that is not the excluded color | ||
*/ | ||
getNextAvailableColor(currentColor: string) { |
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.
This is meant to help with color collisions. It orders the colors based on their usage count in the chart. Least used colors will be preferred. This does not guarantee full protection against color collisions, which should be implemented at the individual viz based on their shape.
@@ -256,10 +264,51 @@ export class Tabs extends React.PureComponent { | |||
} | |||
}; | |||
|
|||
// the initial color map is generated on save and catches all rendered charts |
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.
Currently the initial color map is stored in the dashboard metadata at save but fails to map colors of charts that are hidden within tabs as those are not rendered. This checks for new colors popping in the color map that are not stored in metadata yet when a tab and its charts are rendered. It then updates the metadata accordingly. The stored color map is then used by the viz in Explore to respect the colors of the dashboard context.
@villebro this is meant to fix the regression introduced in #23762 so there is not much more context to add. However, I added inline/GitHub comments to the parts of the code that I think introduce new behaviours or that might require clarifications. |
A few thoughts about the current state of the implementation and the way forward:
CC @eschutho |
/testenv up |
@geido Ephemeral environment spinning up at http://35.86.251.170:8080. Credentials are |
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorScale.ts
Outdated
Show resolved
Hide resolved
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.
Looks good to me, and I really like your thoughts on moving forward — this seems very complicated as is today.
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.
LGTM, sorry for the long delay after my first review!
…o/ch79154/fix-color-inconsistency
I'd love to see a user-oriented FAQ entry "How do colors get assigned to my dashboard?" |
/testenv up |
@geido Ephemeral environment spinning up at http://34.219.194.7:8080. Credentials are |
…o/ch79154/fix-color-inconsistency
/testenv up |
@geido Ephemeral environment spinning up at http://54.202.10.57:8080. Credentials are |
…o/ch79154/fix-color-inconsistency
Ephemeral environment shutdown and build artifacts deleted. |
(cherry picked from commit 313ee59)
SUMMARY
After the changes in this PR #23762 color inconsistency on refreshes was reintroduced.
Fixes #16970
Fixes #26456
Fixes #28104
Fixes #25384 (specifically for metrics changing colors on refreshes. An additional fix is required for charts emitting only COUNT(*) as label and not specific ones)
This PR does the following:
LabelColorsMap
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N.A.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION