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

[Discover] Add "Chart options" menu #112453

Merged
merged 22 commits into from
Sep 28, 2021

Conversation

kertal
Copy link
Member

@kertal kertal commented Sep 16, 2021

Summary

This PR implements the "Charts options" menu in the top section of the main area of Discover. With the upcoming ML's Data Visualizer this area gets crowded (it was already, especially in mobile view). So now it looks like this:

Bildschirmfoto 2021-09-28 um 07 40 36

Hiding the chart and assigning it's interval were merged into this new element

Discover_-_Elastic_und_Discover_-_Elastic_und_matthiaswilhelm_—_matthiaswilhelm_kertal-elastic_—___—_-zsh_—_132×25_und_matthiaswilhelm_—_matthiaswilhelm_kertal-elastic_—___—_-zsh_—_80×24_und_Slack___Andrea_Del_Rio___Elastic___1_new_item

The warning that the selected interval was invalid is also inside the Chart options menu (Usually selecting Milliseconds as interval with a long time range triggers this warning):

Bildschirmfoto 2021-09-21 um 15 54 43

Additionally the "Count" label of the y-axis was removed (since it's obvious what's displayed)

Fixes #112149

Checklist

Delete any items that are not applicable to this PR.

@kertal kertal added release_note:enhancement Feature:Discover Discover Application v8.0.0 v7.16.0 Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels Sep 16, 2021
@kertal kertal self-assigned this Sep 16, 2021
@kertal kertal marked this pull request as ready for review September 21, 2021 14:02
@kertal kertal requested a review from a team as a code owner September 21, 2021 14:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kertal kertal requested review from a team, andreadelrio and gchaps September 21, 2021 14:02
@kertal
Copy link
Member Author

kertal commented Sep 21, 2021

dear @gchaps , just a question about wording, is "Chart options" fine? thx ... ah yes, also a ping, because this will be a change to document :)

@kertal kertal requested a review from timroes September 21, 2021 14:23
@timroes
Copy link
Contributor

timroes commented Sep 22, 2021

In general code looks good to me, I would suggest two more things:

In the original ticket and meeting we've discussed moving the "time range" (currently above the chart) into the x-axis label of the chart. That way we get that space free for the view switcher. I think we should still do that within this PR. There is currently a tooltip assigned stating "To change the time, use the global time filter." I don't think we need to cary that over to the axis legend (if that would even be possible).

Moving that over also has the nice advantage we can improve the movile view. Currently it looks like this:

screenshot-20210922-135658

I think it would be better if the date is in the x-axis label and instead we could keep the hit count left aligned and the chart setting right aligned within the same row.

@kertal
Copy link
Member Author

kertal commented Sep 22, 2021

@timroes yes, this looks much better, however, the x-axis is a bit long, and can be truncated depending on window width

Bildschirmfoto 2021-09-22 um 18 32 40

So I wonder, is info like "order_date per 30 seconds" really necessary?

@kertal
Copy link
Member Author

kertal commented Sep 22, 2021

@elasticmachine merge upstream

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

I think this is looking nice! Just a couple of nits since we're already in there:

  1. I noticed there's more space between the chart and the x-axis label than between the x-axis label and the table. Can we reduce the former?

  2. There's also unequal white space on the sides of the chart. This one might be trickier to solve but at the very least I would ask that we set padding-right to zero for .dscHistogram

Frame 10

Also noticed that the x-axis label is not wrapping in small screens.

image 37

@timroes
Copy link
Contributor

timroes commented Sep 23, 2021

@kertal I agree, I think we should just get rid of the actual field name and interval and only have the timestamp there, nothing else.

If we are still worried about them being cut off on smaller screens then, I think what we could use the useIsWithinBreakpoints method from EUI, to shorten or hide that label completely on small screens.

@kertal
Copy link
Member Author

kertal commented Sep 23, 2021

@kertal I agree, I think we should just get rid of the actual field name and interval and only have the timestamp there, nothing else.

If we are still worried about them being cut off on smaller screens then, I think what we could use the useIsWithinBreakpoints method from EUI, to shorten or hide that label completely on small screens.

@timroes think this is fine, also for smaller screens:
Bildschirmfoto 2021-09-23 um 10 53 49

@andreadelrio note that we should keep padding of .dscHistogram, since this whitespace is used by the legend. I've added bottom padding to the chart, it was set to 0 (@markov00 can I reduce the distance of the x-axis label to the axis of Discover histogram ? Thx!)

…ertal/kibana into kertal-pr-implement-chart-options-menu
@kertal kertal requested a review from andreadelrio September 23, 2021 09:04
@kertal
Copy link
Member Author

kertal commented Sep 23, 2021

@elasticmachine merge upstream

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Tested on Chrome Linux. Seems to work finde. Code LGTM assuming green CI.

I think there is just some minor change we need to be aware of, but I think they are all fine:

When you hide the chart you now no longer see the timerange, since it's hidden too. I think that is okay, and we need that original space still for the view switcher later.

When showing a chart again, the shown time range is calculated again. That is currently fine, since we anyway do a full new request when showing the chart. If we'd just load the chart data again when showing the chart again, and not the documents, we'd still keep updating the shown time range. Though in that case we'd anyway show the chart on a different time range than the documents, if we'd implement that, and the quesiton would anyway be: what should that timerange represent. Thus I am also fine with that behavior.

kertal and others added 2 commits September 23, 2021 13:01
…hart/discover_chart.tsx

Co-authored-by: Tim Roes <mail@timroes.de>
@andreadelrio
Copy link
Contributor

Seems like the label is getting cut off in mobile.

image

@kertal
Copy link
Member Author

kertal commented Sep 23, 2021

Seems like the label is getting cut off in mobile.

image

@andreadelrio Yes, but I don't think there's a good way to solve this, since it's the label of the x-axis. What we could do is rendering those outside the canvas, then we would have all options

@kertal
Copy link
Member Author

kertal commented Sep 27, 2021

@andreadelrio @timroes so, that's how it could look like, when showing the time range outside the canvas
👍 not cut of in mobile
👎 needs more vertical screen space
Applied it to this PR, easy to go back
Bildschirmfoto 2021-09-27 um 13 31 30
Bildschirmfoto 2021-09-27 um 11 22 33

@andreadelrio
Copy link
Contributor

@andreadelrio @timroes so, that's how it could look like, when showing the time range outside the canvas
👍 not cut of in mobile
👎 needs more vertical screen space

@kertal thanks for exploring that route. I'd add negative margin-top to .dscHistogramTimeRange and I'd say we're good to go.

.dscHistogramTimeRange {
   margin-top: - $euiSizeS;
}

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

LGTM!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 437 427 -10

Async chunks

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

id before after diff
discover 378.7KB 377.7KB -1006.0B

History

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

cc @kertal

@kertal kertal merged commit c4ddb01 into elastic:master Sep 28, 2021
kertal added a commit to kertal/kibana that referenced this pull request Sep 28, 2021
Co-authored-by: Tim Roes <mail@timroes.de>
kertal added a commit that referenced this pull request Sep 28, 2021
Co-authored-by: Tim Roes <mail@timroes.de>

Co-authored-by: Tim Roes <mail@timroes.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discover] Add "Chart options" menu
5 participants