Skip to content

Commit 1ebf816

Browse files
committed
addressing pr comments
1 parent 45ce923 commit 1ebf816

1 file changed

Lines changed: 29 additions & 40 deletions

File tree

x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -179,46 +179,35 @@ export function TimeseriesChart({
179179
);
180180
})}
181181

182-
{anomalySeries &&
183-
Object.keys(anomalySeries).map((key) => {
184-
const anomalyType = key as keyof AnomalySeries;
185-
const anomaly = anomalySeries[anomalyType];
186-
if (anomalyType === 'bounderies') {
187-
return (
188-
<AreaSeries
189-
key={anomaly.title}
190-
id={anomaly.title}
191-
xScaleType={ScaleType.Time}
192-
yScaleType={ScaleType.Linear}
193-
xAccessor="x"
194-
yAccessors={['y']}
195-
y0Accessors={['y0']}
196-
data={isEmpty ? [] : anomaly.data}
197-
color={anomaly.color}
198-
curve={CurveType.CURVE_MONOTONE_X}
199-
hideInLegend
200-
filterSeriesInTooltip={() => false}
201-
/>
202-
);
203-
}
204-
return (
205-
<RectAnnotation
206-
key={anomaly.title}
207-
id="score_anomalies"
208-
dataValues={(anomaly.data as RectCoordinate[]).map(
209-
({ x0, x: x1 }) => ({
210-
coordinates: {
211-
x0,
212-
x1,
213-
},
214-
})
215-
)}
216-
style={{
217-
fill: anomaly.color,
218-
}}
219-
/>
220-
);
221-
})}
182+
{anomalySeries?.bounderies && (
183+
<AreaSeries
184+
key={anomalySeries.bounderies.title}
185+
id={anomalySeries.bounderies.title}
186+
xScaleType={ScaleType.Time}
187+
yScaleType={ScaleType.Linear}
188+
xAccessor="x"
189+
yAccessors={['y']}
190+
y0Accessors={['y0']}
191+
data={anomalySeries.bounderies.data}
192+
color={anomalySeries.bounderies.color}
193+
curve={CurveType.CURVE_MONOTONE_X}
194+
hideInLegend
195+
filterSeriesInTooltip={() => false}
196+
/>
197+
)}
198+
199+
{anomalySeries?.scores && (
200+
<RectAnnotation
201+
key={anomalySeries.scores.title}
202+
id="score_anomalies"
203+
dataValues={(anomalySeries.scores.data as RectCoordinate[]).map(
204+
({ x0, x: x1 }) => ({
205+
coordinates: { x0, x1 },
206+
})
207+
)}
208+
style={{ fill: anomalySeries.scores.color }}
209+
/>
210+
)}
222211
</Chart>
223212
</ChartContainer>
224213
);

0 commit comments

Comments
 (0)