From fa57a78cb91cde3a8c68094abce488edd8cd3289 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sat, 7 May 2022 01:28:42 +0400 Subject: [PATCH] fix: victory groups order --- src/web/questions/components/HistoryChart.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/web/questions/components/HistoryChart.tsx b/src/web/questions/components/HistoryChart.tsx index 852140f..a5e0600 100644 --- a/src/web/questions/components/HistoryChart.tsx +++ b/src/web/questions/components/HistoryChart.tsx @@ -269,13 +269,15 @@ export const HistoryChart: React.FC = ({ question }) => { // tickFormat specifies how ticks should be displayed tickFormat={(x) => `${x * 100}%`} /> - { - dataSets - .map((dataSet, i) => - getVictoryGroup({ data: dataSet, i, highlight: i === highlight }) - ) - .reverse() // affects svg render order, we want to render largest datasets on top of others - } + {[...Array(MAX_LINES).keys()] + .reverse() // affects svg render order, we want to render largest datasets on top of others + .map((i) => + getVictoryGroup({ + data: dataSets[i], + i, + highlight: i === highlight, + }) + )} ({ name, color: colors[i] }))}