+
{chartDescription && (
- {chartDescription}
+ {chartDescription}
)}
diff --git a/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_chart_tooltip_styles.ts b/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_chart_tooltip_styles.ts
new file mode 100644
index 0000000000000..dceda53fbb12a
--- /dev/null
+++ b/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_chart_tooltip_styles.ts
@@ -0,0 +1,50 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+import { useEuiFontSize, useEuiTheme } from '@elastic/eui';
+import { useMemo } from 'react';
+import { css } from '@emotion/react';
+
+export const useExplorerChartTooltipStyles = () => {
+ const { euiTheme } = useEuiTheme();
+ const euiFontSizeXS = useEuiFontSize('xs').fontSize;
+
+ return useMemo(
+ () => ({
+ tooltip: css({
+ maxWidth: '384px',
+ }),
+ descriptionList: css({
+ display: 'grid',
+ gridTemplateColumns: 'max-content auto',
+ '& > *': {
+ marginTop: euiTheme.size.xs,
+ },
+ }),
+ title: css({
+ color: euiTheme.colors.ghost,
+ fontSize: euiFontSizeXS,
+ fontWeight: 'normal',
+ whiteSpace: 'nowrap',
+ gridColumnStart: 1,
+ }),
+ description: css({
+ color: euiTheme.colors.ghost,
+ fontSize: euiFontSizeXS,
+ fontWeight: 'bold',
+ paddingLeft: euiTheme.size.s,
+ maxWidth: '256px',
+ gridColumnStart: 2,
+ }),
+ chartDescription: css({
+ fontSize: euiFontSizeXS,
+ fontStyle: 'italic',
+ }),
+ }),
+ [euiFontSizeXS, euiTheme]
+ );
+};
diff --git a/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_charts_container.js b/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_charts_container.js
index 2f8a2cbbfcc09..a9baf5dbd60d8 100644
--- a/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_charts_container.js
+++ b/x-pack/platform/plugins/shared/ml/public/application/explorer/explorer_charts/explorer_charts_container.js
@@ -4,8 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
-import './_index.scss';
-
import React, { useEffect, useState, useCallback, useRef } from 'react';
import {
diff --git a/x-pack/platform/plugins/shared/ml/public/application/explorer/swimlane_container.tsx b/x-pack/platform/plugins/shared/ml/public/application/explorer/swimlane_container.tsx
index 4b4ffbe7ff37a..7fc776502d1bc 100644
--- a/x-pack/platform/plugins/shared/ml/public/application/explorer/swimlane_container.tsx
+++ b/x-pack/platform/plugins/shared/ml/public/application/explorer/swimlane_container.tsx
@@ -54,7 +54,6 @@ import type { SwimlaneType } from './explorer_constants';
import { SWIMLANE_TYPE } from './explorer_constants';
import { mlEscape } from '../util/string_utils';
import { FormattedTooltip } from '../components/chart_tooltip/chart_tooltip';
-import './_explorer.scss';
import { EMPTY_FIELD_VALUE_LABEL } from '../timeseriesexplorer/components/entity_control/entity_control';
import { SWIM_LANE_LABEL_WIDTH, Y_AXIS_LABEL_PADDING } from './constants';
@@ -418,7 +417,18 @@ export const SwimlaneContainer: FC
= ({
if (noSwimLaneData) {
onRenderComplete?.();
}
-
+ const swimlaneStyles = css({
+ '.echLegendListContainer': {
+ height: '34px !important',
+ },
+ '.echLegendList': {
+ display: 'flex !important',
+ justifyContent: 'space-between !important',
+ flexWrap: 'nowrap',
+ position: 'absolute',
+ right: 0,
+ },
+ });
// A resize observer is required to compute the bucket span based on the chart width to fetch the data accordingly
return (
@@ -452,86 +462,91 @@ export const SwimlaneContainer: FC = ({
hidden={noSwimLaneData}
>
{showSwimlane && !isLoading && (
-
-
- {
- if (isRendered && onRenderComplete) {
- onRenderComplete();
- }
- }}
- />
-
-
+
+
+ {
+ if (isRendered && onRenderComplete) {
+ onRenderComplete();
+ }
+ }}
+ />
+
+ {
- return laneLabel === '' ? EMPTY_FIELD_VALUE_LABEL : String(laneLabel);
- }}
- xAxisLabelFormatter={(v) => {
- timeBuckets.setInterval(`${swimlaneData.interval}s`);
- const scaledDateFormat = timeBuckets.getScaledDateFormat();
- return moment(v).format(scaledDateFormat);
- }}
- />
-
+ }}
+ ySortPredicate="dataIndex"
+ yAxisLabelFormatter={(laneLabel) => {
+ return laneLabel === '' ? EMPTY_FIELD_VALUE_LABEL : String(laneLabel);
+ }}
+ xAxisLabelFormatter={(v) => {
+ timeBuckets.setInterval(`${swimlaneData.interval}s`);
+ const scaledDateFormat = timeBuckets.getScaledDateFormat();
+ return moment(v).format(scaledDateFormat);
+ }}
+ />
+
+
)}
{isLoading && (
diff --git a/x-pack/test/functional/services/ml/anomaly_explorer.ts b/x-pack/test/functional/services/ml/anomaly_explorer.ts
index 6774bd097f001..7f9cc1a7e7b03 100644
--- a/x-pack/test/functional/services/ml/anomaly_explorer.ts
+++ b/x-pack/test/functional/services/ml/anomaly_explorer.ts
@@ -160,7 +160,7 @@ export function MachineLearningAnomalyExplorerProvider(
});
// changing to the dashboard app might take some time
const embeddable = await testSubjects.find('mlAnomalySwimlaneEmbeddableWrapper', 30 * 1000);
- const swimlane = await embeddable.findByClassName('mlSwimLaneContainer');
+ const swimlane = await embeddable.findByTestSubject('mlSwimLaneContainer');
expect(await swimlane.isDisplayed()).to.eql(
true,
'Anomaly swim lane should be displayed in dashboard'