feat: render highlighted series last
This commit is contained in:
parent
7b1ccc2252
commit
da66ea05f8
|
@ -278,13 +278,22 @@ export const HistoryChart: React.FC<Props> = ({ question }) => {
|
||||||
/>
|
/>
|
||||||
{[...Array(MAX_LINES).keys()]
|
{[...Array(MAX_LINES).keys()]
|
||||||
.reverse() // affects svg render order, we want to render largest datasets on top of others
|
.reverse() // affects svg render order, we want to render largest datasets on top of others
|
||||||
|
.filter((i) => i !== highlight)
|
||||||
.map((i) =>
|
.map((i) =>
|
||||||
getVictoryGroup({
|
getVictoryGroup({
|
||||||
data: dataSets[i],
|
data: dataSets[i],
|
||||||
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>
|
</VictoryChart>
|
||||||
<Legend
|
<Legend
|
||||||
items={dataSetsNames.map((name, i) => ({ name, color: colors[i] }))}
|
items={dataSetsNames.map((name, i) => ({ name, color: colors[i] }))}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user