Skip to content

Commit 74457d9

Browse files
authored
[ML] Fix event rate chart annotation position (#91899) (#92062)
1 parent 9d58b75 commit 74457d9

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

x-pack/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/event_rate_chart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export const EventRateChart: FC<Props> = ({
7878
<OverlayRange
7979
key={i}
8080
overlayKey={i}
81-
eventRateChartData={eventRateChartData}
8281
start={range.start}
8382
end={range.end}
8483
color={range.color}

x-pack/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/overlay_range.tsx

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,18 @@
77

88
import React, { FC } from 'react';
99
import { EuiIcon } from '@elastic/eui';
10-
import { RectAnnotation, LineAnnotation, AnnotationDomainTypes } from '@elastic/charts';
11-
import { LineChartPoint } from '../../../../common/chart_loader';
10+
import { RectAnnotation, LineAnnotation, AnnotationDomainTypes, Position } from '@elastic/charts';
1211
import { timeFormatter } from '../../../../../../../../common/util/date_utils';
1312

1413
interface Props {
1514
overlayKey: number;
16-
eventRateChartData: LineChartPoint[];
1715
start: number;
1816
end: number;
1917
color: string;
2018
showMarker?: boolean;
2119
}
2220

23-
export const OverlayRange: FC<Props> = ({
24-
overlayKey,
25-
eventRateChartData,
26-
start,
27-
end,
28-
color,
29-
showMarker = true,
30-
}) => {
31-
const maxHeight = Math.max(...eventRateChartData.map((e) => e.value));
32-
21+
export const OverlayRange: FC<Props> = ({ overlayKey, start, end, color, showMarker = true }) => {
3322
return (
3423
<>
3524
<RectAnnotation
@@ -41,8 +30,6 @@ export const OverlayRange: FC<Props> = ({
4130
coordinates: {
4231
x0: start,
4332
x1: end,
44-
y0: 0,
45-
y1: maxHeight,
4633
},
4734
},
4835
]}
@@ -62,16 +49,16 @@ export const OverlayRange: FC<Props> = ({
6249
opacity: 0,
6350
},
6451
}}
52+
markerPosition={Position.Bottom}
53+
hideTooltips={true}
6554
marker={
6655
showMarker ? (
67-
<>
68-
<div style={{ marginLeft: '20px' }}>
69-
<div style={{ textAlign: 'center' }}>
70-
<EuiIcon type="arrowUp" />
71-
</div>
72-
<div style={{ fontWeight: 'normal', color: '#343741' }}>{timeFormatter(start)}</div>
56+
<div>
57+
<div style={{ textAlign: 'center' }}>
58+
<EuiIcon type="arrowUp" />
7359
</div>
74-
</>
60+
<div style={{ fontWeight: 'normal', color: '#343741' }}>{timeFormatter(start)}</div>
61+
</div>
7562
) : undefined
7663
}
7764
/>

0 commit comments

Comments
 (0)