Skip to content

Commit

Permalink
fix: fix event of angle axis in radarchart, fix #3343
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Oct 25, 2024
1 parent 9c42e51 commit a43470d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/vchart/src/component/axis/base-axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export abstract class AxisComponent<T extends ICommonAxisSpec & Record<string, a
protected abstract collectSeriesField(depth: number, series: ISeries): string | string[];
abstract transformScaleDomain(): void;
protected abstract updateScaleRange(): boolean;
protected abstract getDefaultInteractive(): boolean;

protected _dataFieldText: string;
protected _axisMark: IComponentMark;
Expand Down Expand Up @@ -170,6 +171,7 @@ export abstract class AxisComponent<T extends ICommonAxisSpec & Record<string, a
if (isValid(this._spec.id)) {
axisMark.setUserId(this._spec.id);
}
axisMark.setInteractive(this._spec.interactive ?? this.getDefaultInteractive());
this._marks.addMark(axisMark);

if (this._spec.grid?.visible) {
Expand All @@ -188,11 +190,6 @@ export abstract class AxisComponent<T extends ICommonAxisSpec & Record<string, a
this._gridMark = gridMark;
}

// interactive
if (isBoolean(this._spec.interactive)) {
this._marks.forEach(m => m.setInteractive(this._spec.interactive));
}

// Tip: 支持 spec.animationAppear.axis,并且坐标轴默认关闭动画
if (
this._option.animation !== false &&
Expand Down
4 changes: 4 additions & 0 deletions packages/vchart/src/component/axis/cartesian/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export abstract class CartesianAxis<T extends ICartesianAxisCommonSpec = ICartes
return this._orient;
}

protected getDefaultInteractive() {
return true;
}

protected _autoIndentOnce: boolean = false;
protected _hasAutoIndent: boolean = false;
set autoIndentOnce(v: boolean) {
Expand Down
6 changes: 5 additions & 1 deletion packages/vchart/src/component/axis/polar/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export abstract class PolarAxis<T extends IPolarAxisCommonSpec = IPolarAxisCommo
return this._orient;
}

protected getDefaultInteractive() {
return this._orient !== 'angle';
}

protected _groupScales: IBaseScale[] = [];
getGroupScales() {
return this._groupScales;
Expand Down Expand Up @@ -452,7 +456,7 @@ export abstract class PolarAxis<T extends IPolarAxisCommonSpec = IPolarAxisCommo
};
const attrs: any = {
...commonAttrs,
...this.getRefLayoutRect(),
size: this.getRefLayoutRect(),
title: {
text: this._spec.title.text || this._dataFieldText
},
Expand Down

0 comments on commit a43470d

Please sign in to comment.