fix: victory groups order

This commit is contained in:
Vyacheslav Matyukhin 2022-05-07 01:28:42 +04:00
parent cf8d79b8e4
commit fa57a78cb9
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -269,13 +269,15 @@ export const HistoryChart: React.FC<Props> = ({ question }) => {
// tickFormat specifies how ticks should be displayed
tickFormat={(x) => `${x * 100}%`}
/>
{
dataSets
.map((dataSet, i) =>
getVictoryGroup({ data: dataSet, i, highlight: i === highlight })
)
{[...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,
})
)}
</VictoryChart>
<Legend
items={dataSetsNames.map((name, i) => ({ name, color: colors[i] }))}