Skip to content

Commit

Permalink
[ML] Fixes Anomaly Explorer swimlane label and chart tooltips (#61327)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
peteharverson and elasticmachine authored Mar 26, 2020
1 parent cec9165 commit 6d23735
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import 'components/explorer_chart_label/index';
@import 'explorer_chart';
@import 'explorer_chart_tooltip';
@import 'explorer_charts_container';
@import 'explorer_charts_container';
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import './_explorer_chart_label.scss';
import PropTypes from 'prop-types';
import React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import './_explorer_chart_tooltip.scss';
import PropTypes from 'prop-types';
import React from 'react';

Expand Down
14 changes: 11 additions & 3 deletions x-pack/plugins/ml/public/application/explorer/explorer_swimlane.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,17 @@ export class ExplorerSwimlane extends React.Component {
.each(function() {
if (swimlaneData.fieldName !== undefined) {
d3.select(this)
.on('mouseover', label => {
.on('mouseover', value => {
mlChartTooltipService.show(
[{ skipHeader: true }, { name: swimlaneData.fieldName, value: label }],
[
{ skipHeader: true },
{
label: swimlaneData.fieldName,
value,
seriesIdentifier: { key: value },
valueAccessor: 'fieldName',
},
],
this,
{
x: laneLabelWidth,
Expand All @@ -400,7 +408,7 @@ export class ExplorerSwimlane extends React.Component {
.on('mouseout', () => {
mlChartTooltipService.hide();
})
.attr('aria-label', label => `${mlEscape(swimlaneData.fieldName)}: ${mlEscape(label)}`);
.attr('aria-label', value => `${mlEscape(swimlaneData.fieldName)}: ${mlEscape(value)}`);
}
});

Expand Down

0 comments on commit 6d23735

Please sign in to comment.