-
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] Add collapse fn to table and xy chart #131748
Conversation
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
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.
Joe this looks and it works great!
I only have a UX question, it is not so important, but I just want to discuss it
I have a chart like this (collapsed by sum)
I see that the breakdown has this invisible icon and no palette which makes sense. But the color of my chart is defined by the palette. As a user, my first instinct was to go to the metric and change the color of my series from there but I can't. I can only change the color by changing the palette and I dont have a lot of options here as the first palette color is automatically selected.
I find a bit confusing but maybe it is just me. Wdyt?
No, you are right, it should be possible to change the color like as for a regular metric, gonna adjust that. |
@stratoula Fixed, the color pickers is now enabled if the breakdown dimension is collapsed. |
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.
Thank you Joe! This looks great 👏 LGTM!
The 5KB increase is due to the new expression right?
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
To update your PR or re-run it, just comment with: |
changes LGTM |
Fixes #94619
This PR adds the ability to collapse the xy breakdown dimension or an arbitrary "row" in the table visualization.
If selected, the chart behaves as if the dimension doesn't exist, and its values are aggregated according to the selected function.
It would be theoretically possible to add a similar functionality to the partition chart but I don't see a large value for that because there are no common use cases where this would be necessary (and it's also no gap w.r.t. TSVB). Because of this IMHO such a feature would be more confusing than helpful for partition charts and it's better to push some possible exotic use cases into the text based languages.
Technical details
The collapse function is a separate expression function
lens_collapse
which takes a datatable and a list of columns to split by (the buckets) and a list of columns to collapse (the metrics) by a given functionfn
. All other columns are removed in the process. It's similar tooverall_metric
with the difference that the result isn't written to a separate column but instead replaces the existing metric column values and only produces a single row per group.It is called by the supporting visualization before the table is passed to the actual visualization function). In case a collapse function is selected on a dimension, it is hidden for the visualization function.
Note: This PR overlaps with #131699 as it needs to migrate the datatable visualization off multi table to make it work.