-
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] Display legend inside chart #105571
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'm not convinced by the Alignment field:
would it be better to have a group of 4 buttons pointing to each screen corner? (quick mockup):
Or even something more minimal with just the arrow pointing to the corner.
Is the Show value feature broken? I've tried to enable it but it does not work.
I find the Number of columns option very useful: it would be nice to extend it also to the external legend positioning (maybe followup)
x-pack/plugins/lens/public/shared_components/legend_location_settings.tsx
Show resolved
Hide resolved
@MichaelMarcialis what do you think of @dej611's question here #105571 (review) |
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 agree with @dej611 that the current horizontal/vertical controls are using confusing icons. EUI provides 4 icons like editorPositionTopLeft
which we should probably use to control both horizontal and vertical position at the same time.
@dej611 I tested the "show value" option and it works correctly.
Is it an elastic-charts feature that there is a background color assigned on hover? Is this something that works in dark mode?
x-pack/plugins/lens/public/shared_components/legend_location_settings.tsx
Outdated
Show resolved
Hide resolved
I agree with @dej611's suggested change. As @wylieconlon already noted, we can use the following EUI icons to represent each corner in a single
|
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 looking good, @stratoula! I've left a few comments for your review:
-
Rather than using two separate/distinct form rows and labels for "Position" and "Alignment," could we just have a single form row called "Alignment," and change the contained button group depending on which location modes (inside/outside) is selected? I think doing so will be less confusing to users, as the two perform very similar functions, despite having different button group options.
-
Currently, the "Number of columns" form row disappears when the "Location" is set to "Outside." However, other form inputs within this menu become disabled rather than hidden when they are unavailable (but can still be re-enabled in the current context). As such, can we instead disable the "Number of columns" form input when "Location" is set to "Outside," rather than hiding it altogether?
-
For situations when a form input is disabled due to currently selected options, can we indicate to users how they can go about re-enabling that form input? For example, when "Display" is set to "Hide," could we have tooltips that appear on hover of the "Location," "Alignment," "Number of columns," and "Show value" inputs that states
Requires legend to be shown
? Similarly, when "Location" is set to "Outside", the now disabled "Number of columns" input can have a tooltip on hover that statesRequires legend to be located inside visualization
.
x-pack/plugins/lens/public/shared_components/legend_location_settings.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/shared_components/legend_location_settings.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/shared_components/legend_location_settings.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/shared_components/legend_settings_popover.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
Yes @wylieconlon it is. |
Thank you all for the alignment buttons suggestion. It is much better that way! @MichaelMarcialis I have addressed all your comments (I hope).
Can you take another look? Thanx :) |
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.
One more comment, maybe for @markov00: it seems like the inner legend + columns option leads to overflow pretty often, especially when the # of columns is higher than the available width. Is this something that the charts library can detect and solve automatically?
Something like that can be done probably, but my suggestion is to reduce the max number of columns to 4 max 5 for now. |
I agree, I reduced it to max5 for now |
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.
Thanks for making those requested changes, @stratoula. The addition of the tooltips did create one small bug, where when the tooltips are present the elements contained within collapse down (due to the tooltip container being inline by default). You should be able to fix this by applying a display="block"
prop to the related EuiToolTip
components.
Otherwise, this looks good to me once the above is addressed. Approving now so I don't hold you up.
Just tested and the 5 max limit imposed is only checked if the user uses the input number steppers handles. Probably a validation should be set on top of it for user's manual input? |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
* [Lens] Legend inside chart * Apply design feedback * Add unit tests * Update snapshot * Add disabled state and unit tests * revert css change * Address PR comments * Reduce the max columns to 5 * Address last comments * minor * Add a comment Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [Lens] Legend inside chart * Apply design feedback * Add unit tests * Update snapshot * Add disabled state and unit tests * revert css change * Address PR comments * Reduce the max columns to 5 * Address last comments * minor * Add a comment Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…y-show-migrate-to-authzd-users * 'master' of github.com:elastic/kibana: (48 commits) [Canvas] Expression shape (elastic#103219) [FTR] Skips Vega tests [Sample data] Use Lens in ecommerce data (elastic#106039) [APM] Backends inventory & overview page routes (elastic#106223) [TSVB] Add more functional tests for Gauge and TopN (elastic#105361) Add toggle to enable/disable rule install from SOs (elastic#106189) Improve unit test coverage of FS API calls (elastic#106242) Remove recursive plugin status in meta field (elastic#106286) [Ingest pipelines] add community id processor (elastic#103863) [XY axis] Fixes the values inside bar charts (elastic#106198) [data.search] Set default expiration to 1m if search sessions are disabled (elastic#105329) set the doc title when navigating to reporting and unset when navigating away (elastic#106253) [Lens] Display legend inside chart (elastic#105571) [RAC] [TGrid] Migrate the TGrid's rendering to `EuiDataGrid` (elastic#106199) [Security Solutions] Removes the elastic legacy client from lists and security_solution plugins (elastic#106130) [Enterprise Search] Require security plugin in 8.0 (elastic#106307) [DOCS] Updates screenshots in Dev Tools docs (elastic#105859) [DOCS] Updates text and screenshots in tags doc (elastic#105853) [Alerting] Allow rule types to extract/inject saved object references on rule CRU (elastic#101896) Jest and Storybook fixes (elastic#104991) ... # Conflicts: # x-pack/plugins/reporting/public/plugin.ts
Summary
Closes #95887
This PR adds more options to the legend popover of the XY axis charts to enable the users to display the legend inside the chart.
Options that are added:
All settings are disabled if the
hide
display option is selected.Checklist
Delete any items that are not applicable to this PR.