-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Maps] Fix custom color ramp on save #59953
Conversation
Pinging @elastic/kibana-gis (Team:Geo) |
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 fixing.
fwiw I wouldn't do this method rename in a spot-fix for a patch like this.
@@ -226,16 +223,6 @@ export class DynamicColorProperty extends DynamicStyleProperty { | |||
return ['match', ['to-string', ['get', this._options.field.name]], ...mbStops]; | |||
} | |||
|
|||
_getMbOrdinalColorStops() { |
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 removing and improving symmetry between cat and ordinal
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* [Maps] Fix custom color ramp on save * clean up Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Refactoring for categorical color palettes introduced a bug with ordinal custom color ramps. To view the bug, follow the following steps
bytes
. Add at least 2 color stopssave
in the top nav. Notice that the map fill color is not longer styled after saving.Before saving
After saving
The problem is this guard against incomplete color configuration, https://github.com/elastic/kibana/blob/7.6/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_color_property.js#L108
During the refactoring for categorical color palettes, styleOptions.color is getting removed from the options during save. This causes this guard to return false even though the color configuration is complete for custom color ramp.
This PR cleans up the logic of
_getMbColor
to better check for config completeness when using custom color ramps and palettes. The PR also adds some unit tests to ensure the various configurations work as expected.