@@ -592,8 +592,13 @@ export class DataZoomRenderer {
592592 } ) ;
593593 }
594594
595- private _computeBasePoints ( ) {
596- const { orient, isReverse = false } = this . attribute as DataZoomAttributes ;
595+ private _computeBasePoints ( points : IPointLike [ ] ) {
596+ const { orient } = this . attribute as DataZoomAttributes ;
597+ const key = orient === 'bottom' || orient === 'top' ? 'x' : 'y' ;
598+ let lastPointSide = Math . sign ( points [ points . length - 1 ] [ key ] - points [ 0 ] [ key ] ) ;
599+ if ( lastPointSide === 0 ) {
600+ lastPointSide = 1 ;
601+ }
597602 const { position, width, height } = this . _getLayoutAttrFromConfig ( ) ;
598603 let basePointStart : any ;
599604 let basePointEnd : any ;
@@ -638,7 +643,7 @@ export class DataZoomRenderer {
638643 ] ;
639644 }
640645
641- if ( isReverse ) {
646+ if ( Math . sign ( basePointEnd [ 0 ] [ key ] - basePointStart [ 0 ] [ key ] ) !== lastPointSide ) {
642647 return {
643648 basePointStart : basePointEnd ,
644649 basePointEnd : basePointStart
@@ -676,7 +681,7 @@ export class DataZoomRenderer {
676681 // 采样
677682 previewPoints = this . _simplifyPoints ( previewPoints ) ;
678683
679- const { basePointStart, basePointEnd } = this . _computeBasePoints ( ) ;
684+ const { basePointStart, basePointEnd } = this . _computeBasePoints ( previewPoints ) ;
680685 return basePointStart . concat ( previewPoints ) . concat ( basePointEnd ) ;
681686 }
682687
@@ -697,7 +702,7 @@ export class DataZoomRenderer {
697702 // 采样
698703 previewPoints = this . _simplifyPoints ( previewPoints ) ;
699704
700- const { basePointStart, basePointEnd } = this . _computeBasePoints ( ) ;
705+ const { basePointStart, basePointEnd } = this . _computeBasePoints ( previewPoints ) ;
701706 return basePointStart . concat ( previewPoints ) . concat ( basePointEnd ) ;
702707 }
703708
0 commit comments