-
Notifications
You must be signed in to change notification settings - Fork 821
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
EuiColorStops
with user-defined ranges
#2396
Conversation
Are the thumbs at the missing range extent needed? Could you just default to a min/max and then if a user sets the value to a value greater than the max then that becomes the new max? |
@nreese I've updated it to be closer to what you've suggested. It now sets min/max defaults if not given, and user-added stops will reset those values. There's still work to be done in resetting min/max after they've been set by users, but I want to be sure that this is close to what you had in mind. |
Gave this a brief check. I think the premise and feedback feel right. Don't forget docs. |
EuiColorStops
with user-defined rangesEuiColorStops
with user-defined ranges
It is a little jarring when starting with an empty ramp and the first click in the slider creates a stop to the far left. Instead, could the stop stay were the user clicked in the slider? With only a single stop, the marker should be more near the center instead to the far left. Is it possible to provide some buffer to on the ends of the min and max stops (like 5% of the length)? In the case of maps, anything to the left of the min stop is not given a style and will be colored grey. Anything to the right of max stop will be given the color of the max stop. Either way, data can and will be outside of the min/max stops. Showing how data reacts before the first stop and after the last stop would be really useful for users. |
We could work something out here. I think the main adjustment would be to remove the current behavior of always using added stops as the bounds. The problem likely lies, then, in discerning the default bounds. That is, the current default range for and empty set is 0-100. If I add a stop in the middle, and change its value to 200, should 200 then become the max, or should the max become 400 so the added stop stays in the middle? Maybe the fact that the user explicitly changes the value is the deciding factor.
This is a good idea. @ryankeairns, if we were to do this, do you have any thoughts on how to indicate that this "extra" space is not interactive? Also, should the color of this out-of-bounds area be editable by the user? Any other thoughts? |
All that ^ to say, we're trying to visually represent an adjustable, near-infinite scale in finite space. So I appreciate the thought and feedback, @nreese |
The outer margins should be intractable. If the user creates a new stop past the previous max or min, then the new stop becomes the new max or min and the size of the bar adjusts accordingly. |
Hey, just getting back after being away. I've read through this and am thinking through some possible design solutions. I'm in training during afternoons this week, but will try and get back with some ideas. |
I'm going to move forward with the basics of @nreese's feedback and we can sync designs when you get ideas together |
Most recent changes:
|
Good progress! The description of the low end behavior, and the gray color below, seems intuitive. I'm curious how it should work when the min is 0 and you try to go lower... @nreese can there be a negative min? (fyi, it breaks if you attempt that now). The max stop and right buffer was less intuitive. I understand the coloring and that you'd want to enter a new max beyond that, but not being able to drag to the end, as is stands, felt to me like something had gone wrong from an interaction design standpoint. Perhaps we should use some kind of visual bar or 'partially disabled' stop to help clarify that situation. It could still be interactive but maybe you can only change the stop value? As opposed to clicking in that last section and having it move your new stop back to the max. Alternatively, it may be that the current interaction becomes clearer in combination with the bar? Let's talk it through 🤔 Some initial sketches along that last point: |
Ah that's just a bug. I can get that fixed. If the |
One other concept that goes a slightly different direction would be to display actual min and max text inputs. It's more UI, but it may be worth the clarity here. In this case, the buffer and square points would not be interactive and, thus, the min max would not be color stops but instead be replaced by inputs along with the bar markers. Visually, I think this route does a good job of signifying what exactly is happening. The min/max inputs align with the bars indicating that anything below or above would be colored as indicated. |
The range could be negative. The color stops need to match to user's data and that data can be negative |
After working through these latest code changes, I've realized something that I think @nreese has been getting at, which is that for a lot of cases |
Another thought is that it seems likely that users will have stop values in mind before beginning. So I'd imagine that entering known values via the text input comprises a good deal of the interaction cases, which is a case that is supported well right now. |
It never hurts to get that feedback. Also, by plain definition, there is something inherently off with going beyond a max. As you're hinting at, maybe there just isn't a max in those cases. I'll keep thinking on this and once we have some options, let's run these examples by some internal folks. 🤔 some input or switch that accepts a value or none (i.e. max: none) |
@bcamper You have any opinions here? Sounds like we need some direction from the maps team. |
The component should handle use cases where there is no max. The last stop just colors anything beyond the stop value. I know a max is needed to size the component but the concept of a max does not really exist for color ramps |
Agree with @nreese. Logically, there's a distinction between how values are mapped to colors, and what range of data you're showing. It's common map-wise to set the color min/max to somewhere within the total value range, e.g. if you want to only emphasize features that are above a baseline value, you might set the color palette "min" value to the median or average, so that all the values that are average and below are just lumped into one color (this requires some kind of insight into the data like a histogram, which we're also looking at). In terms of this component, I think that's what the "ends" of the UI are signifying, and if there's a way to more clearly communicate that "values above/below this point will have this last color", that would be great. Here's an example from Esri where the stops and histogram are integrated, and the min/max is capped to a more narrow range in the middle of the data (so outliers don't wash out the important values). Because it's all integrated (not something I think we can/want to pursue immediately), the color ramp can communicate those "caps"/color continuation directly: There's also some interesting prior color stops UI art in places like Datawrapper: https://academy.datawrapper.de/article/132-how-to-use-the-color-palette-tool |
There are a couple of changes I would like to try:
One additional thought for those implementing this component in their app... it may improve the experience if the min/max are calculated on the fly. In other words, say a user selects a field, a check is then done to find the min max value and, perhaps, round down/up from those to set the starting end points. This way if you have a data set ranging from 107 to 10,798, you start with 100 and 11,000 (for example) instead of 0 and 100. It's not absolutely necessary given you can enter any stop value upon adding a new stop (as described above), but it would reduce the need for users to discover how to expand the default range of 1 to 100. If we agree this is a good recommendation, it could be something we write into the EUI docs. @thompsongl I think these may be reversed in the current example: |
They're correct given the existing concepts. |
Results of a Zoom chat with @snide and @nreese:
|
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.
Checked functionality in browser 💯 . Small note on some sass, otherwise LGTM.
I'm all for getting this out there and collecting feedback as there are several open questions that would benefit from it, but I also feel that a little more time could have been spent on the min/max interaction (see item 1. in my previous comment). Having part of the slider be unreachable (via drag) is not only confusing, but it also leads to some other odd results as seen below: |
Summary
Fixes #2394 by removing
min
andmax
as required props and providing default (but changeable) values. The range extents are purely for visual reference and can be set/reset via user interaction.Checklist
- [ ] Checked in dark mode- [ ] Checked in mobile- [ ] Checked for breaking changes and labeled appropriately