Skip to content

Commit

Permalink
fix: pivot chart spec enable select not work #2210
Browse files Browse the repository at this point in the history
  • Loading branch information
fangsmile committed Nov 7, 2024
1 parent b1beedc commit 174048b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
30 changes: 18 additions & 12 deletions packages/vtable/src/layout/pivot-header-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/vtable/src/scenegraph/graphic/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down

0 comments on commit 174048b

Please sign in to comment.