-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ML] Migrates chart tooltip to react. #48122
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
Conversation
|
Pinging @elastic/ml-ui (:ml) |
💔 Build Failed |
x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip.tsx
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip.tsx
Show resolved
Hide resolved
| } | ||
|
|
||
| &--hidden { | ||
| opacity: 0; |
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.
you can try visibility property
|
|
||
| interface TooltipData { | ||
| name: string; | ||
| value: any; |
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.
string | ReactElement?
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.
Fixed to reuse the types provided by Elastic Charts in a270966 (However, Elastic Charts treat this as any internally).
| clearTimeout(this.fadeTimeout); | ||
| } | ||
| // side bar width | ||
| const euiNavDrawer = document.getElementsByClassName('euiNavDrawer'); |
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.
is it possible to use ref here instead of imperatively access the DOM?
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.
That element is in a completely different area in Kibana we don't control. I'll leave this as-is replacement for the previous jQuery-based version in here for now.
x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.js
Show resolved
Hide resolved
💚 Build Succeeded |
| }, { | ||
| br: '<br />', | ||
| scheduledEventsValue: marker.scheduledEvents.map(mlEscape).join('<br/>') | ||
| tooltipData.push({ |
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.
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.
Added a fix in 002ccfb to better handle multiple events within a tooltip. There's not much I can do in the case above, but the updated max-width: 512px might help.
peteharverson
left a comment
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.
Tested latest edits and all LGTM
jgowdyelastic
left a comment
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.
LGTM
💚 Build Succeeded |
- The tooltip styling, code and features have been updated to be more in line with Elastic Charts tooltips. This prepares us should we want to use Elastic Charts' tooltip as is at some point. - jQuery is no longer used in mlChartTooltipService. - The tooltip content is no longer raw HTML, a mostly Elastic Charts compatible data structure is now passed around by mlChartTooltipService.
- The tooltip styling, code and features have been updated to be more in line with Elastic Charts tooltips. This prepares us should we want to use Elastic Charts' tooltip as is at some point. - jQuery is no longer used in mlChartTooltipService. - The tooltip content is no longer raw HTML, a mostly Elastic Charts compatible data structure is now passed around by mlChartTooltipService.
💚 Build Succeeded |

Summary
Migrates the chart tooltip of Anomaly Explorer and Single Metric Viewer to use React.
jQueryis no longer used inmlChartTooltipService.mlChartTooltipService.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.Documentation was added for features that require explanation or tutorialsUnit or functional tests were updated or added to match the most common scenariosFor maintainers