From 174048b7591a9e4ae3949e53563969ae3d0699f7 Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Thu, 7 Nov 2024 18:57:27 +0800 Subject: [PATCH] fix: pivot chart spec enable select not work #2210 --- .../vtable/src/layout/pivot-header-layout.ts | 30 +++++++++++-------- .../vtable/src/scenegraph/graphic/chart.ts | 4 ++- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/vtable/src/layout/pivot-header-layout.ts b/packages/vtable/src/layout/pivot-header-layout.ts index 8bdcdaa53..24ea9f46b 100644 --- a/packages/vtable/src/layout/pivot-header-layout.ts +++ b/packages/vtable/src/layout/pivot-header-layout.ts @@ -3313,22 +3313,28 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI { return state; } updateDataStateToChartInstance(activeChartInstance?: any): void { - if (!activeChartInstance) { - activeChartInstance = (this._table as PivotChart)._getActiveChartInstance(); + if (activeChartInstance?.getSpec().select?.enable !== false) { + if (!activeChartInstance) { + activeChartInstance = (this._table as PivotChart)._getActiveChartInstance(); + } + const state = this._generateChartState(); + this._indicators.forEach((_indicatorObject: IndicatorData) => { + const chartInstance = _indicatorObject.chartInstance; + if (_indicatorObject.chartSpec.select?.enable !== false) { + chartInstance.updateState(state); + } + }); + activeChartInstance?.updateState(state); } - const state = this._generateChartState(); - this._indicators.forEach((_indicatorObject: IndicatorData) => { - const chartInstance = _indicatorObject.chartInstance; - chartInstance.updateState(state); - }); - activeChartInstance?.updateState(state); } updateDataStateToActiveChartInstance(activeChartInstance?: any): void { - if (!activeChartInstance) { - activeChartInstance = (this._table as PivotChart)._getActiveChartInstance(); + if (activeChartInstance?.getSpec().select?.enable !== false) { + if (!activeChartInstance) { + activeChartInstance = (this._table as PivotChart)._getActiveChartInstance(); + } + const state = this._generateChartState(); + activeChartInstance?.updateState(state); } - const state = this._generateChartState(); - activeChartInstance?.updateState(state); } /** diff --git a/packages/vtable/src/scenegraph/graphic/chart.ts b/packages/vtable/src/scenegraph/graphic/chart.ts index 4d98e38ae..f7871c5c5 100644 --- a/packages/vtable/src/scenegraph/graphic/chart.ts +++ b/packages/vtable/src/scenegraph/graphic/chart.ts @@ -179,7 +179,9 @@ export class Chart extends Group { (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance); this.activeChartInstance.on('click', (params: any) => { - if (Chart.temp) { + if (this.attribute.spec.select?.enable === false) { + table.scenegraph.updateChartState(null); + } else if (Chart.temp) { table.scenegraph.updateChartState(params?.datum); } });