diff --git a/common/changes/@visactor/vchart/fix-bug-of-updateModelSpecSync-in-axis-tick_2024-12-13-06-55.json b/common/changes/@visactor/vchart/fix-bug-of-updateModelSpecSync-in-axis-tick_2024-12-13-06-55.json new file mode 100644 index 0000000000..1d01aecbf4 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-bug-of-updateModelSpecSync-in-axis-tick_2024-12-13-06-55.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix the bug of updateModelSpecSync can not set axis.tick.forceTickCount\n\n", + "type": "none", + "packageName": "@visactor/vchart" + } + ], + "packageName": "@visactor/vchart", + "email": "lixuef1313@163.com" +} \ No newline at end of file diff --git a/packages/vchart/src/component/axis/cartesian/linear-axis.ts b/packages/vchart/src/component/axis/cartesian/linear-axis.ts index 37b54d1545..7ad14d69d8 100644 --- a/packages/vchart/src/component/axis/cartesian/linear-axis.ts +++ b/packages/vchart/src/component/axis/cartesian/linear-axis.ts @@ -10,7 +10,8 @@ import { Factory } from '../../../core/factory'; import { registerAxis } from '../base-axis'; import { registerLineAxis, registerLineGrid } from '@visactor/vgrammar-core'; import { registerDataSetInstanceTransform } from '../../../data/register'; -import { continuousTicks, ICartesianTickDataOpt } from '@visactor/vrender-components'; +import type { ICartesianTickDataOpt } from '@visactor/vrender-components'; +import { continuousTicks } from '@visactor/vrender-components'; import { isXAxis, isZAxis } from './util'; import { combineDomains, isPercent } from '../../../util'; @@ -46,6 +47,10 @@ export class CartesianLinearAxis< setAttrFromSpec(): void { super.setAttrFromSpec(); this.setExtraAttrFromSpec(); + const tickTransform = this._tickData?.[0] + ?.getDataView() + .transformsArr.find(t => t.type === this.registerTicksTransform()); + tickTransform && (tickTransform.options = this._tickTransformOption()); } /**