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] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard #106845

Merged
merged 24 commits into from
Aug 4, 2021

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Jul 27, 2021

Closes: #77530

Summary

[Lens] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard #106845

Implementation notes

  • The activeCursor service has been moved to the charts plugin and exposed through a contract.
  • TSVB, Lens, vis_type_xy and Timelion use activeCursor service from chart plugin
  • to reduce code duplication, use_active_cursor hook was created

Screens

Screen.Recording.2021-07-28.at.12.05.44.PM.mov
Screen.Recording.2021-07-28.at.12.09.11.PM.mov
Screen.Recording.2021-07-28.at.12.11.47.PM.mov

@alexwizp alexwizp self-assigned this Jul 28, 2021
@alexwizp alexwizp added v7.15.0 v8.0.0 release_note:feature Makes this part of the condensed release notes Feature:Lens Feature:TSVB TSVB (Time Series Visual Builder) Feature:XYAxis XY-Axis charts (bar, area, line) Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Jul 28, 2021
@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@alexwizp alexwizp requested a review from markov00 August 2, 2021 12:12
@alexwizp
Copy link
Contributor Author

alexwizp commented Aug 2, 2021

@elasticmachine merge upstream

@alexwizp alexwizp requested a review from a team August 3, 2021 11:18
@elasticmachine
Copy link
Contributor

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

@alexwizp
Copy link
Contributor Author

alexwizp commented Aug 3, 2021

@elasticmachine merge upstream

@alexwizp alexwizp added the Feature:Timelion Timelion app and visualization label Aug 3, 2021
@stratoula stratoula requested review from mbondyra and dej611 August 3, 2021 15:50
Copy link
Contributor

@dej611 dej611 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 Firefox 👍
Lens Code review seems fine to me.

const isDateHistogram =
Boolean(dataTables.length) &&
dataTables.every((dataTable) =>
dataTable.columns.find((c) => Boolean(c.meta.sourceParams?.appliedTimeRange))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe .some is more suited than find here?
No big deal, in terms of perf I think they are equivalent, it's just about semantic

@stratoula
Copy link
Contributor

It works well for all charts, sometimes it is laggy, not sure how it will perform with big dashboards and a lot of data.
@ghudgins can you also check it and just to confirm, we decided to go without a setting to disable it?

@mbondyra
Copy link
Contributor

mbondyra commented Aug 4, 2021

@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.

tested on a dashboard with 10 synchronizing visualizations on Safari. Works really well 🆗 Code LGTM!

Copy link
Contributor

@VladLasitsa VladLasitsa left a comment

Choose a reason for hiding this comment

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

Code LGTM!

@alexwizp
Copy link
Contributor Author

alexwizp commented Aug 4, 2021

It works well for all charts, sometimes it is laggy, not sure how it will perform with big dashboards and a lot of data.
@ghudgins can you also check it and just to confirm, we decided to go without a setting to disable it?

@stratoula I've added a small debounce to be sure that that PR will not be a reason of any performance issues.

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

LGTM, thanx Alex :D

@ghudgins
Copy link
Contributor

ghudgins commented Aug 4, 2021

i've tested a mix of different vis types on 30 panels and profiled. it feels like it's doing what it should

image

Copy link
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

This is fantastic! 🎉

Ideally this would be simpler if we on the charts side had a registry of all the charts on a page. This in not in the near future so I'm glad you were able to achieve this as is.

I just have just one comment, see below 👇

xDomain={adjustedXDomain}
rotation={rotation}
theme={[themeOverrides, theme]}
theme={[theme, themeOverrides]}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is flipped, the lower the index the higher the priority. So in this case themeOverrides is used only when the value does not exist on the theme.

Are you running into issue with this? There may be an issue where if a value is undefined on the first object this will not be overridden by the second.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interestingly, after the modifying, it began to work as expected. The same approach is used elsewhere, so if you're right the problem is everywhere

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah. Also if the theme is a full theme, (i.e. defines all available property) that means the overrides are pointless and will never be used.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
charts 68 72 +4
visTypeTimelion 66 65 -1
visTypeTimeseries 538 537 -1
total +2

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.6MB 1.6MB +402.0B
visTypeTimelion 89.3KB 89.1KB -198.0B
visTypeTimeseries 1004.1KB 1003.9KB -154.0B
visTypeXy 113.6KB 113.9KB +314.0B
total +364.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
charts 88.7KB 92.2KB +3.5KB
visTypeTimelion 24.6KB 25.1KB +446.0B
visTypeTimeseries 24.6KB 24.5KB -20.0B
visTypeXy 62.1KB 62.5KB +359.0B
total +4.2KB
Unknown metric groups

API count

id before after diff
charts 195 199 +4

API count missing comments

id before after diff
charts 164 168 +4

Non-exported public API item count

id before after diff
charts 1 3 +2

History

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

cc @alexwizp

@alexwizp alexwizp merged commit f62a0a1 into elastic:master Aug 4, 2021
alexwizp added a commit to alexwizp/kibana that referenced this pull request Aug 4, 2021
…zations in a dashboard (elastic#106845)

* [Lens] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard

Closes: elastic#77530

* add mocks for active_cursor service

* fix jest tests

* fix jest tests

* apply PR comments

* fix cursor style

* update heatmap, jest

* add tests

* fix wrong import

* replace cursor for timelion

* update tsvb_dashboard baseline

* fix CI

* update baseline

* Update active_cursor_utils.ts

* add debounce

* remove cursor from heatmap and pie

* add tests for debounce

* return theme order back

Co-authored-by: Kibana Machine <[email protected]>
alexwizp added a commit that referenced this pull request Aug 4, 2021
…zations in a dashboard (#106845) (#107691)

* [Lens] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard

Closes: #77530

* add mocks for active_cursor service

* fix jest tests

* fix jest tests

* apply PR comments

* fix cursor style

* update heatmap, jest

* add tests

* fix wrong import

* replace cursor for timelion

* update tsvb_dashboard baseline

* fix CI

* update baseline

* Update active_cursor_utils.ts

* add debounce

* remove cursor from heatmap and pie

* add tests for debounce

* return theme order back

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
streamich pushed a commit to vadimkibana/kibana that referenced this pull request Aug 8, 2021
…zations in a dashboard (elastic#106845)

* [Lens] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard

Closes: elastic#77530

* add mocks for active_cursor service

* fix jest tests

* fix jest tests

* apply PR comments

* fix cursor style

* update heatmap, jest

* add tests

* fix wrong import

* replace cursor for timelion

* update tsvb_dashboard baseline

* fix CI

* update baseline

* Update active_cursor_utils.ts

* add debounce

* remove cursor from heatmap and pie

* add tests for debounce

* return theme order back

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens Feature:Timelion Timelion app and visualization Feature:TSVB TSVB (Time Series Visual Builder) Feature:XYAxis XY-Axis charts (bar, area, line) release_note:feature Makes this part of the condensed release notes 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.

[Lens] Synchronize cursor position for X-axis across all Lens visualizations in a dashboard
9 participants