-
Notifications
You must be signed in to change notification settings - Fork 14k
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: repeated color in the same chart #23762
Conversation
52debb3
to
e72bbb3
Compare
5dfbdb6
to
844bee8
Compare
sharedColorMap.forEach((value, key) => { | ||
if (key !== cleanedValue) { | ||
const index = updatedRange.indexOf(value); | ||
updatedRange.splice(index, 1); |
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.
It looks like this may be removing items from a list. Can you use the filter function here instead?
/testenv up |
@eschutho Container image not yet published for this PR. Please try again when build is complete. |
@eschutho Ephemeral environment creation failed. Please check the Actions logs for details. |
Codecov Report
@@ Coverage Diff @@
## master #23762 +/- ##
=======================================
Coverage 68.23% 68.23%
=======================================
Files 1942 1942
Lines 75205 75226 +21
Branches 8145 8148 +3
=======================================
+ Hits 51314 51329 +15
- Misses 21806 21812 +6
Partials 2085 2085
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
6899cc4
to
d5d68b7
Compare
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!
@@ -96,7 +114,12 @@ class CategoricalColorScale extends ExtensibleFunction { | |||
const newColor = this.scale(cleanedValue); |
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 moving the scale to the next color in order
@@ -96,7 +114,12 @@ class CategoricalColorScale extends ExtensibleFunction { | |||
const newColor = this.scale(cleanedValue); | |||
if (!color) { | |||
color = newColor; | |||
if (isFeatureEnabled(FeatureFlag.AVOID_COLORS_COLLISION)) { | |||
this.removeSharedLabelColorFromRange(sharedColorMap, cleanedValue); | |||
color = this.scale(cleanedValue); |
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.
Calling this again will move to the next color in the scale again unnecessarily
SUMMARY
Currently, the charts are experiencing an issue where colors are being repeated even though the color palette has more colors than the chart requires. This is problematic because it can make it difficult for users to distinguish between different data points and can lead to confusion. the code will now check colors in shared label and remove the color for the list.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION