File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -786,6 +786,15 @@ function sortDatumsBySecondaryPx<TDatum>(
786
786
datums : Datum < TDatum > [ ] ,
787
787
secondaryAxes : Axis < TDatum > [ ]
788
788
) {
789
+ if ( secondaryAxes . every ( d => d . stacked ) ) {
790
+ const differingInverts =
791
+ secondaryAxes . some ( d => d . invert ) && secondaryAxes . some ( d => ! d . invert )
792
+
793
+ if ( ! differingInverts ) {
794
+ return datums
795
+ }
796
+ }
797
+
789
798
return [ ...datums ] . sort ( ( a , b ) => {
790
799
const aAxis = secondaryAxes . find ( d => d . id === a . secondaryAxisId )
791
800
const bAxis = secondaryAxes . find ( d => d . id === b . secondaryAxisId )
@@ -796,14 +805,6 @@ function sortDatumsBySecondaryPx<TDatum>(
796
805
const bPx =
797
806
bAxis ?. scale ( bAxis . stacked ? b . stackData ?. [ 1 ] : b . secondaryValue ) ?? NaN
798
807
799
- if ( ( aAxis || bAxis ) ?. stacked ) {
800
- return a . seriesIndex > b . seriesIndex
801
- ? 1
802
- : a . seriesIndex < b . seriesIndex
803
- ? - 1
804
- : 0
805
- }
806
-
807
808
return aPx > bPx ? 1 : aPx < bPx ? - 1 : 0
808
809
} )
809
810
}
You can’t perform that action at this time.
0 commit comments