Skip to content

Commit

Permalink
Merge pull request #2787 from VisActor/2210-bug-vtable-pivotChart-sel…
Browse files Browse the repository at this point in the history
…ectenable

2210 bug vtable pivot chart selectenable
  • Loading branch information
fangsmile authored Nov 11, 2024
2 parents 9c6ce67 + 06fd8e9 commit 463d1a6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: pivot chart spec enable select not work #2210\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
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 @@ -3317,22 +3317,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 463d1a6

Please sign in to comment.