From da66ea05f83cfe97ef9bd58fe4fdc0d8203b817e Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sat, 7 May 2022 01:56:20 +0400 Subject: [PATCH] feat: render highlighted series last --- src/web/questions/components/HistoryChart.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/web/questions/components/HistoryChart.tsx b/src/web/questions/components/HistoryChart.tsx index 7c07829..d9d67cc 100644 --- a/src/web/questions/components/HistoryChart.tsx +++ b/src/web/questions/components/HistoryChart.tsx @@ -278,13 +278,22 @@ export const HistoryChart: React.FC = ({ question }) => { /> {[...Array(MAX_LINES).keys()] .reverse() // affects svg render order, we want to render largest datasets on top of others + .filter((i) => i !== highlight) .map((i) => getVictoryGroup({ data: dataSets[i], i, - highlight: i === highlight, + highlight: false, }) )} + {highlight === undefined + ? null + : // render highlighted series on top of everything else + getVictoryGroup({ + data: dataSets[highlight], + i: highlight, + highlight: true, + })} ({ name, color: colors[i] }))}