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] Add search to chart switcher #77631

Merged
merged 20 commits into from
Oct 6, 2020

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Sep 16, 2020

Fixes #75403

Adds a search to the chart switcher:

Screenshot 2020-10-01 at 10 18 21

This PR adds a property to the visualization types - searchLabel. This optional label can be used to let a visualization type match the current search even if the short label is not matching it.

It also changes the title shown in the collapsed state of the chart picker as suggested in the issue.

The search is performing a simple .includes() match on the lowercased string to the label and the search label of the visualizations - if one of them matches, the visualization gets shown.

If all visualizations are filtered, a callout is displayed:
Screenshot 2020-10-06 at 15 36 31

@flash1293
Copy link
Contributor Author

Jenkins, test this

@flash1293 flash1293 added Feature:Lens release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Sep 18, 2020
@flash1293 flash1293 marked this pull request as ready for review September 18, 2020 12:13
@flash1293 flash1293 requested a review from a team September 18, 2020 12:13
@flash1293 flash1293 requested a review from a team as a code owner September 18, 2020 12:13
@flash1293 flash1293 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 18, 2020
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

This design is adding a lot of whitespace to our chart switcher, instead of increasing its density like most of our competitors do when they want to support more chart types. Some of our competitors have up to 32 chart types that they can fit into one screen without scrolling, which I think is a feature. Did I miss some context for this change @cchaos?

},
{
id: 'line',
icon: LensIconChartLine,
shortLabel: i18n.translate('xpack.lens.xyVisualization.shortLineLabel', {
defaultMessage: 'Vertical',
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really a "vertical line chart", is it? I would rather have repetition and have the category name be "Line" and the visualization is "Line".

@AlonaNadler
Copy link

I checked the pr this morning
My main feedback is there is a lot of spaces between the rows and it shouldn't be scrollable. Once open all chart should be visible.
Let's move the bar chart to the bottom since its the default chart its less likely users will switch to it
Icons on the top of the preview work well. I didn't understand the axis icons but it might be personal perspective. Maybe there is another icon that is more clear

@wylieconlon wylieconlon requested a review from cchaos September 22, 2020 17:19
@cchaos
Copy link
Contributor

cchaos commented Sep 22, 2020

I've responded to this spacing/scrolling problem in #75403 (comment):

I'm not sure there's going to be any way around needing to scroll. We want to display not just the group heading and name of the chart but also a graphic (iconic) representation. This all takes spaces. We could possibly optimize this list for the charts we currently have but that just won't scale as we add more and more. Unless you want the chart selection to cover up most of the application UI, there will always be a need to scroll.

The original ask was:

To make it easier for the user to pick the right one, it should be restyled (introducing sections, adding a search, ...).

This PR does just that. It adds sections with headings to demarcate those sections. It sounds like the main concern is that these sections adds "white space" and increases scrolling. The only remedies I see are to:

  1. Go back to not having sections. Remove the headers
  2. Change the sections. Group Line charts with something else?

There was discussion in #75403 on what those sections would be. I'd suggest continuing to think scalability of those headings and what other charts will be introduced and therefore what the sections should encompass.

From a design standpoint, less white space and scrolling does not equal more scanability/readability. You can increase the size of the popover, but I wouldn't decrease spacing.

@wylieconlon
Copy link
Contributor

Is there any urgency to make this design change? Can we delay this decision until we have new chart types to add, which is post Lens by Default?

@flash1293
Copy link
Contributor Author

flash1293 commented Sep 22, 2020

Issue and PR originated from the percentage mode feature (see this comment: #70703 (comment)) . With the percentage chart types the popover is getting a little messy, but I wouldn’t say it’s completely unusable in the current state. If we are fine with the current look and feel, I wouldn’t object postponing this.

In general I like the sections though and I think it’s worth giving it a little more thought now because IMHO we are not far away from an improvement over the current status.

What about removing the section headers, but keeping a little spacing between the icon groups? This together with an increased height for the popover should be enough to get the current set of visualizations in there without scrolling. It’s still cleaner than the current popover because of distinct groups making it easier to find the right chart type.

@AlonaNadler
Copy link

I agree with @flash1293 let's try not to postpone this

What about removing the section headers, but keeping a little spacing between the icon groups? This together with an increased height for the popover should be enough to get the current set of visualizations in there without scrolling. It’s still cleaner than the current popover because of distinct groups making it easier to find the right chart type.

sounds good

@flash1293
Copy link
Contributor Author

Changed it like this:
Screenshot 2020-09-23 at 16 24 27

Searching for the sections still works - we probably want to rename the line chart to Line. The icons make repeating "bar" in the chart type names unnecessary IMHO (the section has an aria-label).

...visualizationType,
selection: getSelection(visualizationType.visualizationId, visualizationType.id),
})),
.filter(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: moving the filter within the Object.values().map() loop there's less work

@@ -9687,15 +9687,12 @@
"xpack.lens.xySuggestions.unstackedChartTitle": "スタックが解除されました",
"xpack.lens.xySuggestions.yAxixConjunctionSign": " と ",
"xpack.lens.xyVisualization.areaLabel": "エリア",
"xpack.lens.xyVisualization.barHorizontalLabel": "横棒",
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why these files are still touched by the change

@flash1293
Copy link
Contributor Author

Good point @cchaos

This is the updated state:
Screenshot 2020-10-01 at 10 18 21

@mbondyra
Copy link
Contributor

mbondyra commented Oct 1, 2020

Works as expected, tested and reviewed 👌

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

@cchaos
Copy link
Contributor

cchaos commented Oct 2, 2020

I think what we'll want is a fullName and shortName for each chart type. I know this adds a bit more complexity, but it's important for:

  • Allowing a search of Horiz to show all H. named options
  • Allowing tooltips/titles on each keypad item with the full name that also shows the full Horizontal percentage bar label.

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

The title and description of this PR are out of date, but it works well for the smaller scope we agreed on. I also agree with @cchaos about adding an alternate "long name" which should be searchable, so that I can type horiz and get results.

@flash1293 flash1293 changed the title [Lens] Add sections to chart switcher [Lens] Add search to chart switcher Oct 5, 2020
@flash1293
Copy link
Contributor Author

Thanks @wylieconlon updated the description
@cchaos Added a second label so it's possible to search for the full title (also used for the title)

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

Did not test the latest code, but LGTM from previous test and reading the diff

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple design tweaks.

@flash1293 flash1293 requested a review from cchaos October 6, 2020 13:41
@flash1293
Copy link
Contributor Author

@cchaos thanks, I addressed those, could you check again?

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Thanks @flash1293 ! LGTM!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
lens 1.1MB 1.1MB +2.0KB

History

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

@flash1293 flash1293 merged commit 11886bf into elastic:master Oct 6, 2020
@flash1293 flash1293 added v7.10.0 and removed v7.11.0 labels Oct 6, 2020
@flash1293
Copy link
Contributor Author

Not seeing any reason to not ship this in 7.10, changed the labels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Clean up and restyle chart switcher
8 participants