@@ -4,7 +4,7 @@ import { MarkTypeEnum } from '../../mark/interface/type';
44import { isValid } from '@visactor/vutils' ;
55import type { SeriesMarkMap } from '../interface' ;
66import { SeriesMarkNameEnum , SeriesTypeEnum } from '../interface/type' ;
7- import type { IGaugePointerSeriesSpec , IGaugePointerSeriesTheme } from './interface' ;
7+ import type { IGaugePointerSeriesSpec , IGaugePointerSeriesTheme , PinMarkSpec , PointerMarkSpec } from './interface' ;
88import type { Datum , Maybe } from '../../typings' ;
99import type { IPathMark } from '../../mark/path' ;
1010import { animationConfig , userAnimationConfig } from '../../animation/utils' ;
@@ -71,17 +71,17 @@ export class GaugePointerSeries<
7171 if ( pointerMark ) {
7272 this . setMarkStyle ( pointerMark , {
7373 x : ( datum : Datum ) => {
74- const { x } = this . _getPointerAnchor ( datum ) ;
74+ const { x } = this . _getPointerAnchor ( datum , pointerSpec ) ;
7575 const dx = this . _getPointerWidth ( ) * ( pointerSpec ?. center ?. [ 0 ] ?? 0 ) ;
7676 return x - dx ;
7777 } ,
7878 y : ( datum : Datum ) => {
79- const { y } = this . _getPointerAnchor ( datum ) ;
79+ const { y } = this . _getPointerAnchor ( datum , pointerSpec ) ;
8080 const dy = this . _getPointerHeight ( datum ) * ( pointerSpec ?. center ?. [ 1 ] ?? 0 ) ;
8181 return y - dy ;
8282 } ,
8383 anchor : ( datum : Datum ) => {
84- const { x, y } = this . _getPointerAnchor ( datum ) ;
84+ const { x, y } = this . _getPointerAnchor ( datum , pointerSpec ) ;
8585 return [ x , y ] ;
8686 } ,
8787 fill : this . getColorAttribute ( ) ,
@@ -110,7 +110,10 @@ export class GaugePointerSeries<
110110 this . _pointerMark && this . _tooltipHelper . activeTriggerSet . mark . add ( this . _pointerMark ) ;
111111 }
112112
113- protected _getPointerAnchor ( datum : Datum ) {
113+ protected _getPointerAnchor ( datum : Datum , markSpec : PinMarkSpec | PointerMarkSpec ) {
114+ if ( markSpec . isOnCenter ?? true ) {
115+ return this . angleAxisHelper . center ( ) ;
116+ }
114117 return this . radiusAxisHelper . coordToPoint ( {
115118 radius : this . _innerRadius * this . _computeLayoutRadius ( ) ,
116119 angle : this . angleAxisHelper . dataToPosition ( [ datum [ this . _angleField [ 0 ] ] ] )
@@ -158,8 +161,8 @@ export class GaugePointerSeries<
158161 const pinBackgroundSpec = this . _spec . pinBackground ;
159162 if ( pinBackgroundMark ) {
160163 this . setMarkStyle ( pinBackgroundMark , {
161- x : ( datum : Datum ) => this . _getPointerAnchor ( datum ) . x ,
162- y : ( datum : Datum ) => this . _getPointerAnchor ( datum ) . y ,
164+ x : ( datum : Datum ) => this . _getPointerAnchor ( datum , pinBackgroundSpec ) . x ,
165+ y : ( datum : Datum ) => this . _getPointerAnchor ( datum , pinBackgroundSpec ) . y ,
163166 scaleX : ( ) => pinBackgroundSpec . width * this . _computeLayoutRadius ( ) ,
164167 scaleY : ( ) => pinBackgroundSpec . height * this . _computeLayoutRadius ( ) ,
165168 fill : this . getColorAttribute ( ) ,
@@ -173,8 +176,8 @@ export class GaugePointerSeries<
173176 const pinSpec = this . _spec . pin ;
174177 if ( pinMark ) {
175178 this . setMarkStyle ( pinMark , {
176- x : ( datum : Datum ) => this . _getPointerAnchor ( datum ) . x ,
177- y : ( datum : Datum ) => this . _getPointerAnchor ( datum ) . y ,
179+ x : ( datum : Datum ) => this . _getPointerAnchor ( datum , pinSpec ) . x ,
180+ y : ( datum : Datum ) => this . _getPointerAnchor ( datum , pinSpec ) . y ,
178181 scaleX : ( ) => pinSpec . width * this . _computeLayoutRadius ( ) ,
179182 scaleY : ( ) => pinSpec . height * this . _computeLayoutRadius ( ) ,
180183 fill : this . getColorAttribute ( ) ,
0 commit comments