-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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] Make Lens intervals default value adapt to histogram:maxBars Advanced Setting changes #89305
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
@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.
I tested this and it's not the same - if no value is set, the maximum number of buckets is chosen:
kibana/src/plugins/data/common/search/aggs/buckets/lib/histogram_calculate_interval.ts
Line 136 in 170a295
Math.min(maxBucketsUiSettings, maxBucketsUserInput || maxBucketsUiSettings), |
The old logic (just if the panel is open), picked the middle between min and max number of buckets as default.
We either have to make maximum granularity the default in all cases (which means the slider is set to 100% at the beginning) or find a way to set it to "half of max precision" initially to make the behavior consistent.
These screenshots show the problem. I dragged bytes to the x axis, then moved the slider one tick and back:
I tested this PR and agree with @flash1293 that we should restore the previous behavior of choosing 50% of max by default. I remember talking about using 100% of max, but we agreed at the time that it was a confusing UX- it's easier to understand at 50% because you can see there is room to make it denser. |
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 the problem is that we are now storing auto
as the column param for maxBars
instead of a specific number. So this triggers the fallback logic:
// fallback to 0 in case of empty string
maxBars: params.maxBars === AUTO_BARS ? undefined : params.maxBars,
which sets the max bars to 100%, instead of 50% like what the UI shows. So we probably need to change this fallback.
I agree with Wylie, the issue why we can't easily do this in Lens is that we don't have access to ui settings in the
It probably makes sense to keep this in Lens for now. |
Looks like some places still have to be adjusted for the new call signature |
@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.
Tested and works as expected - as long as the user doesn't change something, auto
is saved as interval. Doesn't fail even if the saved interval is out of the max bounds after changing it in advanced settings
Is this an issue? It's kind of borderline, but I'd say to respect user's will in this case. |
No, I think it's fine. Just wanted to document I tested this case :) |
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.
Changes LGTM!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…dvanced Setting changes (elastic#89305) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fixes #83420
This PR uses the UISettings
histogram:maxBars
value only as fallback in case the user hasn't changed the range input yet.This makes the "default value" for the Interval UI dynamically change if a user changes the
histogram:maxBars
value in the Kibana Advanced Settings.To test the feature
price
orbytes
)Records
field in the Vertical axis areamyIntervalChart1
myIntervalChart2
Stack Management > Advanced Settings
maxBars
and change the value from 100 to 50myIntervalChart1
and check that the interval has now changed (compare with the note/screenshot from before)myIntervalChart2
and check that the interval has now changed (compare with the note/screenshot from before). It should be the same size asmyIntervalChart1
one.Tests have been re-adapted to follow the new behaviour.
Checklist