Skip to content

Commit

Permalink
fix: tooltip secondary axis stable sort
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jan 26, 2023
1 parent 3c36b18 commit 786ea07
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,14 @@ function sortDatumsBySecondaryPx<TDatum>(
const bPx =
bAxis?.scale(bAxis.stacked ? b.stackData?.[1] : b.secondaryValue) ?? NaN

return aPx > bPx
? 1
: aPx < bPx
? -1
: a.seriesIndex > b.seriesIndex
? 1
: -1
if ((aAxis || bAxis)?.stacked) {
return a.seriesIndex > b.seriesIndex
? 1
: a.seriesIndex < b.seriesIndex
? -1
: 0
}

return aPx > bPx ? 1 : aPx < bPx ? -1 : 0
})
}

0 comments on commit 786ea07

Please sign in to comment.