From 3c36b18ac17b292f0cc56897df093362bea555d1 Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Thu, 26 Jan 2023 14:19:09 -0700 Subject: [PATCH] fix: tooltip secondary axis stable sort --- src/components/Chart.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Chart.tsx b/src/components/Chart.tsx index 777ad638..5590368e 100644 --- a/src/components/Chart.tsx +++ b/src/components/Chart.tsx @@ -796,6 +796,12 @@ function sortDatumsBySecondaryPx( const bPx = bAxis?.scale(bAxis.stacked ? b.stackData?.[1] : b.secondaryValue) ?? NaN - return aPx - bPx + return aPx > bPx + ? 1 + : aPx < bPx + ? -1 + : a.seriesIndex > b.seriesIndex + ? 1 + : -1 }) }