Skip to content
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] Supports long legend values #107894

Merged
merged 10 commits into from
Aug 17, 2021
Merged

Conversation

stratoula
Copy link
Contributor

@stratoula stratoula commented Aug 9, 2021

Summary

Part of #41418

  • Adds two additional settings on the legend popover.
  • The switch is by default on, and the max lines number input is enabled and set to 1.
  • If the user turns off the switch, the input will be disabled and the legend items will display their whole context.
  • Max truncated lines are set to 5.
  • It is enabled for all visualization types

image

image

Checklist

Delete any items that are not applicable to this PR.

@stratoula stratoula changed the title Lens long legend [Lens] Supports long legend items Aug 10, 2021
@stratoula stratoula changed the title [Lens] Supports long legend items [Lens] Supports long legend values Aug 10, 2021
@stratoula stratoula added Feature:Lens release_note:enhancement v7.15.0 v8.0.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Aug 10, 2021
@stratoula stratoula marked this pull request as ready for review August 10, 2021 10:00
@stratoula stratoula requested a review from a team August 10, 2021 10:00
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@dej611
Copy link
Contributor

dej611 commented Aug 10, 2021

I am not so sure about the multiple options in the legend popover.

What if the max lines would be raised up to 3 (instead of 1) and just make truncation work without an explicit input for the user?
A tooltip on the label can explain that truncation will work if the label is longer and that should be enough I think.
Here I made a mockup with EUI with a range slider + input with max 10 lines for legends (10 lines is already a lot probably?): https://codesandbox.io/s/dazzling-fire-644y3

@stratoula
Copy link
Contributor Author

stratoula commented Aug 10, 2021

So if I understand correctly, you don't want to cover the "zero" case which actually allows the users to display all the legend content. I am not sure about it tbh. I think is most powerful that way but of course, @MichaelMarcialis is the best to decide here. The explanation tooltip seems a good idea to me :)

@dej611
Copy link
Contributor

dej611 commented Aug 10, 2021

So if I understand correctly, you don't want to cover the "zero" case which actually allows the users to display all the legend content. I am not sure about it tbh. I think is most powerful that way but of course, @MichaelMarcialis is the best to decide here. The explanation tooltip seems a good idea to me :)

The upper bound of the range input can be raised if 10 lines are not enough to cover the whole content of the legend entry, but honestly I do not think too many cases will happen because of that.

@stratoula
Copy link
Contributor Author

@elasticmachine merge upstream

@stratoula
Copy link
Contributor Author

cc @AlonaNadler

@AlonaNadler
Copy link

LGTM thanks :)

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent, @stratoula! Well done. For your review, I've left two small text change comments.

Additionally, I have one question/request regarding the current handling of numbers greater than 5 in the maximum lines input. When typing a number greater than 5 and blurring the input, it currently triggers an error state. Instead, if a number greater than 5 is types, can we automatically change it to the highest supported line number (i.e. 5) on blur? That way it saves the user the trouble of correcting and also educates them what the highest value is.

image

Assuming you're able to address these, this PR looks good to me. Approving now so I don't hold you up.

@MichaelMarcialis
Copy link
Contributor

So if I understand correctly, you don't want to cover the "zero" case which actually allows the users to display all the legend content. I am not sure about it tbh. I think is most powerful that way but of course, @MichaelMarcialis is the best to decide here. The explanation tooltip seems a good idea to me :)

Honestly, I'm a bit torn on this myself. I certainly appreciate the simplicity in what @dej611 is suggesting (i.e. truncation always on, with a single input to set the maximum lines). However, the version presented in this PR is more robust in that it supports a total disabling of truncation, which could potentially be helpful to users with odd edge cases (i.e. very lengthy labels).

Assuming it wouldn't be a huge pain to change it in the future, I'm thinking it may be best to keep it as it is here for now and bring it up for discussion with @ghudgins when he returns. Thoughts?

@stratoula
Copy link
Contributor Author

I agree with this plan Michael. I also discussed it with Alona - as Graham is out - and she agrees to also give this option to the users. Let's go with it (as this is also the solution that we agreed with Graham) and I can discuss it again with him when he is back.

@stratoula
Copy link
Contributor Author

@elasticmachine merge upstream

@stratoula
Copy link
Contributor Author

stratoula commented Aug 12, 2021

This looks excellent, @stratoula! Well done. For your review, I've left two small text change comments.

Additionally, I have one question/request regarding the current handling of numbers greater than 5 in the maximum lines input. When typing a number greater than 5 and blurring the input, it currently triggers an error state. Instead, if a number greater than 5 is types, can we automatically change it to the highest supported line number (i.e. 5) on blur? That way it saves the user the trouble of correcting and also educates them what the highest value is.

image

Assuming you're able to address these, this PR looks good to me. Approving now so I don't hold you up.

Sure, I addressed that. When the user types a number greater than 5 and less than 1 (i.e. 0) I automatically change the value to the limits

@stratoula
Copy link
Contributor Author

@elasticmachine merge upstream

@mbondyra
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of my comments is blocking. I tested this feature on FF and works great!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.7MB 1.7MB +6.1KB
Unknown metric groups

API count

id before after diff
lens 216 220 +4

API count missing comments

id before after diff
lens 200 202 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@stratoula stratoula merged commit 8939ee6 into elastic:master Aug 17, 2021
stratoula added a commit to stratoula/kibana that referenced this pull request Aug 17, 2021
* [Lens] Supports multilines legend

* Add a truncate legends switch

* Add more unit tests

* Add tooltip condition

* Adress PR comments

* Apply PR comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
stratoula added a commit that referenced this pull request Aug 17, 2021
* [Lens] Supports multilines legend

* Add a truncate legends switch

* Add more unit tests

* Add tooltip condition

* Adress PR comments

* Apply PR comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants