Skip to content

Commit

Permalink
addressing pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Nov 30, 2020
1 parent 45ce923 commit 1ebf816
Showing 1 changed file with 29 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,46 +179,35 @@ export function TimeseriesChart({
);
})}

{anomalySeries &&
Object.keys(anomalySeries).map((key) => {
const anomalyType = key as keyof AnomalySeries;
const anomaly = anomalySeries[anomalyType];
if (anomalyType === 'bounderies') {
return (
<AreaSeries
key={anomaly.title}
id={anomaly.title}
xScaleType={ScaleType.Time}
yScaleType={ScaleType.Linear}
xAccessor="x"
yAccessors={['y']}
y0Accessors={['y0']}
data={isEmpty ? [] : anomaly.data}
color={anomaly.color}
curve={CurveType.CURVE_MONOTONE_X}
hideInLegend
filterSeriesInTooltip={() => false}
/>
);
}
return (
<RectAnnotation
key={anomaly.title}
id="score_anomalies"
dataValues={(anomaly.data as RectCoordinate[]).map(
({ x0, x: x1 }) => ({
coordinates: {
x0,
x1,
},
})
)}
style={{
fill: anomaly.color,
}}
/>
);
})}
{anomalySeries?.bounderies && (
<AreaSeries
key={anomalySeries.bounderies.title}
id={anomalySeries.bounderies.title}
xScaleType={ScaleType.Time}
yScaleType={ScaleType.Linear}
xAccessor="x"
yAccessors={['y']}
y0Accessors={['y0']}
data={anomalySeries.bounderies.data}
color={anomalySeries.bounderies.color}
curve={CurveType.CURVE_MONOTONE_X}
hideInLegend
filterSeriesInTooltip={() => false}
/>
)}

{anomalySeries?.scores && (
<RectAnnotation
key={anomalySeries.scores.title}
id="score_anomalies"
dataValues={(anomalySeries.scores.data as RectCoordinate[]).map(
({ x0, x: x1 }) => ({
coordinates: { x0, x1 },
})
)}
style={{ fill: anomalySeries.scores.color }}
/>
)}
</Chart>
</ChartContainer>
);
Expand Down

0 comments on commit 1ebf816

Please sign in to comment.