-
Notifications
You must be signed in to change notification settings - Fork 885
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
[Vis Colors] Update color mapper to prioritize unique colors per vis #4890
[Vis Colors] Update color mapper to prioritize unique colors per vis #4890
Conversation
Instead of trying to generate unique colors for an entire dashboard Signed-off-by: Josh Romero <rmerqg@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #4890 +/- ##
==========================================
- Coverage 66.39% 66.34% -0.06%
==========================================
Files 3396 3397 +1
Lines 64801 64805 +4
Branches 10359 10360 +1
==========================================
- Hits 43025 42994 -31
- Misses 19217 19222 +5
- Partials 2559 2589 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: Josh Romero <rmerqg@amazon.com>
let newColors = _.difference(colorPalette, allColors); | ||
}) | ||
.filter((color) => !alreadyUsedColors.includes(color.toLowerCase())) | ||
.slice(0, keysToMap.length); |
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.
Do we need to check that after filtering, we have enough colors? as much as keysToMap.length
? or we don't need to worry about it?
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.
@AMoo-Miki I made this change as more of a surgical minimal change rather than a larger refactor, which this utility could probably use.
My intent is that it will always be the correct length, because we're using the total keys.length
in L110 to generate the colors, and then we're only filtering out alreadyUsedColors
. The intent of the L88-106 block is to push every key
in keys
to either alreadyUsedColors
or keysToMap
. But it could certainly be written cleaner to guarantee that's the case.
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.
Thank you!
…4890) * [Vis Colors] Update color mapper to prioritize unique colors per vis Instead of trying to generate unique colors for an entire dashboard Signed-off-by: Josh Romero <rmerqg@amazon.com> * Update CHANGELOG.md Signed-off-by: Josh Romero <rmerqg@amazon.com> --------- Signed-off-by: Josh Romero <rmerqg@amazon.com> (cherry picked from commit abcef34) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…4890) (#4898) * [Vis Colors] Update color mapper to prioritize unique colors per vis Instead of trying to generate unique colors for an entire dashboard Signed-off-by: Josh Romero <rmerqg@amazon.com> * Update CHANGELOG.md Signed-off-by: Josh Romero <rmerqg@amazon.com> --------- Signed-off-by: Josh Romero <rmerqg@amazon.com> (cherry picked from commit abcef34) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Instead of trying to generate unique colors for an entire dashboard.
Visualizations that use the color mapper (VisLib, VisBuilder, TSVB) will now have the following behavior:
visualization:colorMapping
advanced setting will be respected. Additionally, if one or more series in a visualization have custom color configurations that use OUI qualitative palette colors, those will be skipped when mapping non-customized colors to avoid duplicates. (new feature)Issues Resolved
Fixes #4697
Screenshot
Sample dashboards (next light) after
Notice the consistency across dashboards and data sets:
Sample dashboards (next light) before
Visual Consistency Dashboard (all themes) after
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr