-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Specify Y axis extent #99203
[Lens] Specify Y axis extent #99203
Conversation
This is looking great! Awesome work, @flash1293. Here's some of my quick thoughts based on your special cases:
Can we have help text conditionally appear under the button group that explains "Data bounds" is not available for bar charts (since I believe
I'm concerned that it may not be obvious to users that a blank input means "default" value. Is there a common use case for keeping one bound a default value and the other a custom value? If not or an edge case, I'd be more inclined to populate the custom bounds inputs with the actual default values, so they have a point of reference from which to work.
Rather than relying on the user to fail and see an error message, can we conditionally add help text below the lower bound input that notifies them that the maximum value is zero for bar charts? |
Agreed with your points, except for the one about empty inputs, see below
Did you test the PR locally? IMHO the experience is pretty natural and it's also how other tools do it (including but not limited to the Visualize editor). I don't have data to judge how common it is to define partial bounds, but it's definitely helpful to just specify the lower bound and keep the upper bound "natural" to cut off an area you know will either never be hit or is a natural point of reference (like "Only show values above 100% because these are the only values relevant to me", sort of filtering them) |
Jenkins, test this |
@MichaelMarcialis Implemented your suggestions except for the prefill with current data thing (see discussion above) |
@elasticmachine merge upstream |
@@ -525,6 +525,9 @@ function buildSuggestion({ | |||
xTitle: currentState?.xTitle, | |||
yTitle: currentState?.yTitle, | |||
yRightTitle: currentState?.yRightTitle, | |||
hideEndzones: currentState?.hideEndzones, |
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 a bug fix unrelated to the rest of the PR - the hide endzones parameter was reset when switching between xy chart types
Pinging @elastic/kibana-app (Team:KibanaApp) |
Do we use this "blank equals default" pattern anywhere else within the Lens app? If so, and users at least have some familiarity/experience with such a pattern, I wouldn't be opposed to leaving it as you have it and just monitoring for feedback (or including as part of future usability testing). If not an existing pattern in Lens though, I'd be a little more concerned. If having the full/default mode for one bound and custom mode for another is a common use case we wish to accommodate, I would recommend an interface akin to the quick example below. It couples the mode selection to individual bounds rather than a single mode selector for both, making it a bit more obvious to the user what is happening. Thoughts @flash1293 and @ghudgins? |
@MichaelMarcialis check out the screenshots in the original issue description - we do the same thing in the same config popover for the axis title. I can see the design about different modes for lower and upper bound making sense, but IMHO it's introducing more complexity than necessary. |
@MichaelMarcialis I re-read your comment and I think I there's something I overlooked - the case with axis overwrite is not 100% the same because we show a placeholder. Should we just show the current value as a placeholder in these inputs? I don't have a strong opinion on this, all of them seem fine to me:
Happy to go with your preference for those based on the points raised. For the last one we could treat the user removing the value as falling back to the default (we do the same for the custom dimension label), so we wouldn't lose the feature of partially specified bounds in any way. From the technical side blank inputs are a bit simpler to implement, but it's not a big deal. |
Fair enough. Since you mentioned having used this pattern elsewhere in Lens, I'm OK with keeping it as you have it and just monitoring for feedback.
I think I'm OK with this approach, if I'm understanding correctly. Let me know if this is correct:
If this is correct, I think this is fine. |
@elasticmachine merge upstream |
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.
@flash1293 I've tested this PR and found that it wasn't quite what I was expecting based on what I wrote in this comment. I looked through the comment history and it looks like this is probably unintentional, as it wasn't specifically commented on.
- Bar charts must include 0, which means either the lower or upper bound must be >= 0. You're only validating the lower bound, which allows this broken state from -100 to -5:
- Area charts should get the same validation as bar charts, not the same as line charts.
- Edit: this is happening on master too.
The right axis settings are appearing every time I have 2 metrics, even if both metrics have the same format - You're not validating the bounds on line and area charts: I was expecting that we'd validate that lower is less than upper. This part might be hitting a race condition, because most of the time I only see an empty chart:
setState({ | ||
...state, | ||
yLeftExtent: extent, | ||
}); |
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 think these need debouncing, it's causing a lot of rendering churn in the chart and slowing down typing.
…' into lens/y-offset-reloaded
…into lens/y-offset-reloaded
@wylieconlon @MichaelMarcialis I think I addressed all points, could you have another look?
Error if lower bound is larger than upper bound (change won't be applied) Error if zero is not inclusive for area and bar I couldn't find a good way to show the errors in a single line below both form elements and still keep consistent a11y references, maybe one of you knows a way. |
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 think you've fully addressed my concerns, LGTM!
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.
Hey, @flash1293. Left a handful of comments and suggestions, but nothing worth holding you up over. Provided you address them, this looks good to me. Approving.
x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.tsx
Outdated
Show resolved
Hide resolved
hasBarOrAreaOnAxis && localExtent.mode !== 'custom' | ||
? i18n.translate('xpack.lens.xyChart.axisExtent.disabledDataBoundsMessage', { | ||
defaultMessage: | ||
"Bounds of bar and area series always have to include zero and can't be fit to the data", |
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.
Since we already notify users about the zero inclusion in the custom inputs, I think we can shorten this text by removing that redundant text. Perhaps something like:
"Bounds of bar and area series always have to include zero and can't be fit to the data", | |
"The selected chart cannot be fit to the data bounds.", |
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 think we should tell the user which charts can be fit to data bounds, otherwise they just a have a problem, but no obvious solution. I renamed to "Only line charts can be fit to the data bounds"
x-pack/plugins/lens/public/xy_visualization/axis_settings_popover.tsx
Outdated
Show resolved
Hide resolved
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Co-authored-by: Joe Reuter <[email protected]>
@flash1293 Thanks for implementing this. Just what I needed for a viz. I ran into some problems when using the custom extend. I'm not sure if the problems were introduced by this PR but I've created a follow-up issue here: #107622 |
Depends on #100108
Fixes #67614
Fixes #99662
As discussed in the issue.
Special cases:
Not ready to review in detail yet.
What do you think @ghudgins @MichaelMarcialis ?