-
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] custom color ramp #41603
[Maps] custom color ramp #41603
Conversation
Pinging @elastic/kibana-gis |
@alexfrancoeur Does the color ramp work as expected? Stops are numbers in strictly ascending order. The range is from the given stop number (inclusive) to the next stop number (exclusive). |
💔 Build Failed |
@nreese If we can, I feel like we should be consistent with other ranges defined in Kibana visualizations. Lens, Canvas and others: ? That being said, I don't think we're consistent defining ranges anywhere. If we're getting a common color stop UI from design, I think we have some freedom here. In the current implementation, as a new user, I'm not sure how obvious it is that you're defining a range or matching a for a single metric. For example, in your screenshot above it could easily be argued that that UI is only showing colors for when a value is 0, or 6, or 12, etc. Also, what operators are being used - I happen to like how TSVB defines this logic (screenshot above), but I'm not sure if it's more or less confusing for a new user. I think I prefer this method because you can define exactly what each range is. |
Yep. The lower part won't even be in there when we're done, and will hopefully happen all through popovers. As mentioned, the component @nreese has in now will be temporary till we get the new one in. It's gonna be a lot more technically challenging to build so we didn't want to hold up this PR. Hopefully be able to just swap this in when we're done. |
Talked with @snide and color stop UI with the color bar will not make 7.4 FF. So this PR will need to move ahead with the color stop UI as is.
@alexfrancoeur The other range definitions are defining a range. This UI is not defining ranges. The UI is defining color stops and color stops do not need to be provided in pairs. |
💔 Build Failed |
💚 Build Succeeded |
Ah well, it'll be nice to have it when it's ready though. Do we think 7.5?
Makes sense to me. Honestly, any way we can introduce this type of functionality to our users will be fine for the first iteration. I still think the color stopping is a bit more obvious with the EUI component and we'll get there eventually |
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 dig it!
Some initial comments. Biggest change imo would be not using interpolation, although that may be worth a larger discussion.
x-pack/legacy/plugins/maps/public/layers/styles/components/vector/color/color_stops.js
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/components/vector/legend/vector_icon.js
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/maps/public/layers/styles/components/vector/color/color_stops_utils.js
Show resolved
Hide resolved
return null; | ||
if (styleDescriptor.options.useCustomColorRamp && | ||
(!styleDescriptor.options.customColorRamp || | ||
!styleDescriptor.options.customColorRamp.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.
Can this (!styleDescriptor.options.customColorRamp || !styleDescriptor.options.customColorRamp.length)
ever arise? I think the UX already prevents creating dysfunctional color ramps. And if it doesn't, shouldn't 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.
Can this (!styleDescriptor.options.customColorRamp || !styleDescriptor.options.customColorRamp.length) ever arise
Yes. The default vector style does not set customColorRamp
so when useCustomColorRamp
is first set to true, customColorRamp
is undefined until a color has been added with ColorStops
x-pack/legacy/plugins/maps/public/layers/styles/vector_style.js
Outdated
Show resolved
Hide resolved
.../legacy/plugins/maps/public/layers/styles/components/vector/color/dynamic_color_selection.js
Show resolved
Hide resolved
💚 Build Succeeded |
@thomasneirynck I have updated the PR to use |
💚 Build Succeeded |
💚 Build Succeeded |
… color expressions
💚 Build Succeeded |
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.
very sweet, thank you! This is going to be super useful ..
💚 Build Succeeded |
* [Maps] custom color ramp * round value down to find center color * do not update redux state with invalide color stops * rename EuiColorStop to ColorStop * remove untracked file * fix jest tests * review feedback * use steps instead of interpolate * add percy functional test to verify rendering of interpolate and step color expressions * add padding to color stop row so add/remove icons do not overlap color select
* [Maps] custom color ramp * round value down to find center color * do not update redux state with invalide color stops * rename EuiColorStop to ColorStop * remove untracked file * fix jest tests * review feedback * use steps instead of interpolate * add percy functional test to verify rendering of interpolate and step color expressions * add padding to color stop row so add/remove icons do not overlap color select
Thanks for this... considering we end users had to hack CSS in previous versions to get custom color ranges anything will be great! Is there an estimate for 7.4 release? |
Yes, the feature is merged into 7.x branch so should be included in the next release |
@maihde this meet your needs or need algorithmic ramp like #5058 (comment) |
fixes #27716
This PR adds the ability to specify custom color ramp with stop values for data-driven styling.
The color stop UI is temporary. @snide is working on a new color stop UI that will replace the one currently used in this PR.