feat: render highlighted series last

This commit is contained in:
Vyacheslav Matyukhin 2022-05-07 01:56:20 +04:00
parent 7b1ccc2252
commit da66ea05f8
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -278,13 +278,22 @@ export const HistoryChart: React.FC<Props> = ({ 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,
})}
</VictoryChart>
<Legend
items={dataSetsNames.map((name, i) => ({ name, color: colors[i] }))}