@visactor/vtable 1.22.10 → 1.22.11-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/cjs/PivotChart.d.ts +1 -0
  2. package/cjs/PivotChart.js +5 -4
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/core/BaseTable.js +1 -1
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/dataset/dataset-pivot-table.js +1 -2
  7. package/cjs/edit/editors.js +2 -1
  8. package/cjs/event/listener/table-group.js +10 -6
  9. package/cjs/event/listener/table-group.js.map +1 -1
  10. package/cjs/index.d.ts +1 -1
  11. package/cjs/index.js +1 -1
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/layout/index.js +2 -1
  14. package/cjs/layout/pivot-header-layout.d.ts +6 -0
  15. package/cjs/layout/pivot-header-layout.js +40 -21
  16. package/cjs/layout/pivot-header-layout.js.map +1 -1
  17. package/cjs/layout/row-height-map.js +1 -1
  18. package/cjs/layout/simple-header-layout.js +1 -1
  19. package/cjs/layout/tree-helper.js +1 -1
  20. package/cjs/plugins/custom-cell-style.js +1 -2
  21. package/cjs/plugins/interface.js +1 -1
  22. package/cjs/plugins/invert-highlight.js +1 -1
  23. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  24. package/cjs/plugins/plugin-manager.js +1 -1
  25. package/cjs/scenegraph/graphic/active-cell-chart-list.d.ts +2 -0
  26. package/cjs/scenegraph/graphic/active-cell-chart-list.js +101 -43
  27. package/cjs/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  28. package/cjs/scenegraph/graphic/chart.d.ts +8 -1
  29. package/cjs/scenegraph/graphic/chart.js +42 -18
  30. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  31. package/cjs/scenegraph/graphic/contributions/chart-render.js +3 -4
  32. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  33. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -1
  34. package/cjs/scenegraph/refresh-node/update-chart.js +2 -1
  35. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  36. package/cjs/scenegraph/scenegraph.d.ts +2 -2
  37. package/cjs/scenegraph/scenegraph.js +14 -8
  38. package/cjs/scenegraph/scenegraph.js.map +1 -1
  39. package/cjs/tools/util.d.ts +5 -0
  40. package/cjs/tools/util.js +22 -4
  41. package/cjs/tools/util.js.map +1 -1
  42. package/cjs/ts-types/table-engine.d.ts +6 -0
  43. package/cjs/ts-types/table-engine.js.map +1 -1
  44. package/cjs/vrender.js.map +1 -1
  45. package/dist/vtable.js +390 -151
  46. package/dist/vtable.min.js +1 -1
  47. package/es/PivotChart.d.ts +1 -0
  48. package/es/PivotChart.js +5 -4
  49. package/es/PivotChart.js.map +1 -1
  50. package/es/core/BaseTable.js +1 -1
  51. package/es/core/BaseTable.js.map +1 -1
  52. package/es/dataset/dataset-pivot-table.js +1 -2
  53. package/es/edit/editors.js +2 -1
  54. package/es/event/listener/table-group.js +9 -6
  55. package/es/event/listener/table-group.js.map +1 -1
  56. package/es/index.d.ts +1 -1
  57. package/es/index.js +1 -1
  58. package/es/index.js.map +1 -1
  59. package/es/layout/index.js +2 -1
  60. package/es/layout/pivot-header-layout.d.ts +6 -0
  61. package/es/layout/pivot-header-layout.js +40 -21
  62. package/es/layout/pivot-header-layout.js.map +1 -1
  63. package/es/layout/row-height-map.js +1 -1
  64. package/es/layout/simple-header-layout.js +1 -1
  65. package/es/layout/tree-helper.js +1 -1
  66. package/es/plugins/custom-cell-style.js +1 -2
  67. package/es/plugins/interface.js +1 -1
  68. package/es/plugins/invert-highlight.js +1 -1
  69. package/es/plugins/list-tree-stick-cell.js +1 -1
  70. package/es/plugins/plugin-manager.js +1 -1
  71. package/es/scenegraph/graphic/active-cell-chart-list.d.ts +2 -0
  72. package/es/scenegraph/graphic/active-cell-chart-list.js +96 -41
  73. package/es/scenegraph/graphic/active-cell-chart-list.js.map +1 -1
  74. package/es/scenegraph/graphic/chart.d.ts +8 -1
  75. package/es/scenegraph/graphic/chart.js +42 -17
  76. package/es/scenegraph/graphic/chart.js.map +1 -1
  77. package/es/scenegraph/graphic/contributions/chart-render.js +3 -4
  78. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  79. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -1
  80. package/es/scenegraph/refresh-node/update-chart.js +2 -1
  81. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  82. package/es/scenegraph/scenegraph.d.ts +2 -2
  83. package/es/scenegraph/scenegraph.js +14 -8
  84. package/es/scenegraph/scenegraph.js.map +1 -1
  85. package/es/tools/util.d.ts +5 -0
  86. package/es/tools/util.js +18 -0
  87. package/es/tools/util.js.map +1 -1
  88. package/es/ts-types/table-engine.d.ts +6 -0
  89. package/es/ts-types/table-engine.js.map +1 -1
  90. package/es/vrender.js.map +1 -1
  91. package/package.json +5 -5
@@ -171,4 +171,4 @@ function indexFirst(arr, elm) {
171
171
  const tempI = high < 0 ? 0 : high;
172
172
  return arr[tempI] === elm ? tempI : -1;
173
173
  }
174
- //# sourceMappingURL=row-height-map.js.map
174
+ //# sourceMappingURL=row-height-map.js.map
@@ -812,4 +812,4 @@ export class SimpleHeaderLayoutMap {
812
812
  if (col >= 0) return col < this.leftRowSeriesNumberColumnCount ? this.leftRowSeriesNumberColumn[col].define : this.transpose ? this._columns[row].define : this._columns[col - this.leftRowSeriesNumberColumnCount].define;
813
813
  }
814
814
  }
815
- //# sourceMappingURL=simple-header-layout.js.map
815
+ //# sourceMappingURL=simple-header-layout.js.map
@@ -407,4 +407,4 @@ export function deleteTreeHideNode(tree_children, dimensionPath, indicators, has
407
407
  dimensionPath.pop();
408
408
  }
409
409
  }
410
- //# sourceMappingURL=tree-helper.js.map
410
+ //# sourceMappingURL=tree-helper.js.map
@@ -103,5 +103,4 @@ export function mergeStyle(cacheStyle, customCellStyle) {
103
103
 
104
104
  export const registerCustomCellStylePlugin = () => {
105
105
  Factory.registerComponent("customCellStylePlugin", CustomCellStylePlugin);
106
- };
107
- //# sourceMappingURL=custom-cell-style.js.map
106
+ };
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -11,4 +11,4 @@ export function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
11
11
  });
12
12
  }
13
13
  }
14
- //# sourceMappingURL=invert-highlight.js.map
14
+ //# sourceMappingURL=invert-highlight.js.map
@@ -175,4 +175,4 @@ function scrollToRow(row, table) {
175
175
  export const registerListTreeStickCellPlugin = () => {
176
176
  Factory.registerComponent("listTreeStickCellPlugin", ListTreeStickCellPlugin);
177
177
  };
178
- //# sourceMappingURL=list-tree-stick-cell.js.map
178
+ //# sourceMappingURL=list-tree-stick-cell.js.map
@@ -51,4 +51,4 @@ export class PluginManager {
51
51
  }));
52
52
  }
53
53
  }
54
- //# sourceMappingURL=plugin-manager.js.map
54
+ //# sourceMappingURL=plugin-manager.js.map
@@ -10,4 +10,6 @@ export declare function generateChartInstanceListByRowDirection(row: number, dim
10
10
  x: number;
11
11
  y: number;
12
12
  }, table: BaseTableAPI, hideTooltip?: boolean, isScatter?: boolean): void;
13
+ export declare function generateChartInstanceListByViewRange(datum: any, table: BaseTableAPI, deactivate?: boolean): void;
13
14
  export declare function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI): void;
15
+ export declare function clearAllChartInstanceList(table: BaseTableAPI): void;
@@ -15,39 +15,26 @@ export function generateChartInstanceListByColumnDirection(col, dimensionValueOr
15
15
  chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.activeChartInstance || chartNode.activate(table),
16
16
  chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance),
17
17
  setTimeout((() => {
18
- var _a, _b, _c, _d, _e, _f;
18
+ var _a, _b, _c, _d;
19
19
  if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
20
20
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
21
21
  let isShowTooltip = !isScatter;
22
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
23
- i === rowEnd && isShowTooltip) {
24
- const heightLimitToShowTooltipForEdgeRow = null !== (_c = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _c ? _c : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
25
- if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
26
- const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
27
- isShowTooltip = rowEnd2 !== rowEnd;
28
- }
29
- } else if (i === rowStart && isShowTooltip) {
30
- const heightLimitToShowTooltipForEdgeRow = null !== (_d = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _d ? _d : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
31
- if (rowStart1 === rowStart) isShowTooltip = !0; else {
32
- const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
33
- isShowTooltip = rowStart2 !== rowStart;
34
- }
35
- }
36
- if (isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_f = (_e = chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _f || _f.call(_e, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
37
- const bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
22
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
23
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table)), isScatter) table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || null === (_d = (_c = chartInstanceListColumnByColumnDirection[col][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
24
+ const cellBoundry = table.getCellRelativeRect(col, i), bodyBoundryTop = table.frozenRowCount ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom : 0, absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);
38
25
  hideTooltip ? (table.stateManager.hover.cellPos.col === col && table.stateManager.hover.cellPos.row === i || chartInstanceListColumnByColumnDirection[col][i].hideTooltip(),
39
26
  chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
40
27
  tooltip: !1,
41
28
  showTooltipOption: {
42
- x: canvasXY.x,
43
- y: absolutePositionTop,
29
+ x: canvasXY.x - cellBoundry.left,
30
+ y: absolutePositionTop - cellBoundry.top,
44
31
  activeType: "dimension"
45
32
  }
46
33
  })) : chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {
47
34
  tooltip: isShowTooltip,
48
35
  showTooltipOption: {
49
- x: canvasXY.x,
50
- y: absolutePositionTop,
36
+ x: canvasXY.x - cellBoundry.left,
37
+ y: absolutePositionTop - cellBoundry.top,
51
38
  activeType: "dimension"
52
39
  }
53
40
  });
@@ -87,35 +74,22 @@ export function generateChartInstanceListByRowDirection(row, dimensionValueOrXVa
87
74
  if (null === (_a = chartInstanceListRowByRowDirection[row]) || void 0 === _a ? void 0 : _a[i]) {
88
75
  const chartDimensionLinkage = table.options.chartDimensionLinkage;
89
76
  let isShowTooltip = !isScatter;
90
- if (!isScatter && "object" == typeof chartDimensionLinkage) if (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
91
- i === colEnd && isShowTooltip) {
92
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
93
- if (colEnd1 === colEnd) isShowTooltip = !0; else {
94
- const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
95
- isShowTooltip = colEnd2 !== colEnd;
96
- }
97
- } else if (i === colStart && isShowTooltip) {
98
- const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
99
- if (colStart1 === colStart) isShowTooltip = !0; else {
100
- const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
101
- isShowTooltip = colStart2 !== colStart;
102
- }
103
- }
104
- if (isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
105
- const bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
77
+ if (isScatter || "object" != typeof chartDimensionLinkage || (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
78
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(i, table)), isScatter) table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || null === (_d = (_c = chartInstanceListRowByRowDirection[row][i]).showCrosshair) || void 0 === _d || _d.call(_c, (axis => "left" === axis.layoutOrient ? positionValueOrYValue : dimensionValueOrXValue)); else {
79
+ const cellBoundry = table.getCellRelativeRect(i, row), bodyBoundryLeft = table.frozenColCount ? table.getCellRelativeRect(table.frozenColCount - 1, row).right : 0, absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);
106
80
  hideTooltip ? (table.stateManager.hover.cellPos.col === i && table.stateManager.hover.cellPos.row === row || chartInstanceListRowByRowDirection[row][i].hideTooltip(),
107
81
  chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
108
82
  tooltip: !1,
109
83
  showTooltipOption: {
110
- x: absolutePositionLeft,
111
- y: canvasXY.y,
84
+ x: absolutePositionLeft - cellBoundry.left,
85
+ y: canvasXY.y - cellBoundry.top,
112
86
  activeType: "dimension"
113
87
  }
114
88
  })) : chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {
115
89
  tooltip: isShowTooltip,
116
90
  showTooltipOption: {
117
- x: absolutePositionLeft,
118
- y: canvasXY.y,
91
+ x: absolutePositionLeft - cellBoundry.left,
92
+ y: canvasXY.y - cellBoundry.top,
119
93
  activeType: "dimension"
120
94
  }
121
95
  });
@@ -125,6 +99,82 @@ export function generateChartInstanceListByRowDirection(row, dimensionValueOrXVa
125
99
  }
126
100
  }
127
101
 
102
+ export function generateChartInstanceListByViewRange(datum, table, deactivate = !1) {
103
+ var _a;
104
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
105
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
106
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
107
+ const {colStart: colStart} = table.getBodyVisibleColRange();
108
+ let colEnd = table.getBodyVisibleColRange().colEnd;
109
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
110
+ for (let col = colStart; col <= colEnd; col++) {
111
+ isValid(chartInstanceListColumnByColumnDirection[col]) || (chartInstanceListColumnByColumnDirection[col] = {});
112
+ for (let i = rowStart; i <= rowEnd; i++) {
113
+ const cellGroup = table.scenegraph.getCell(col, i), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
114
+ chartNode.addUpdateShapeAndBoundsTag(), chartInstanceListColumnByColumnDirection[col][i] || isValid(chartNode) && (chartNode.activeChartInstance ? chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance : "pie" === chartNode.attribute.spec.type && (chartNode.activate(table),
115
+ chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance)),
116
+ setTimeout((() => {
117
+ var _a, _b;
118
+ if (null === (_a = chartInstanceListColumnByColumnDirection[col]) || void 0 === _a ? void 0 : _a[i]) {
119
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
120
+ let isShowTooltip = !0;
121
+ "object" == typeof chartDimensionLinkage && (deactivate ? (chartInstanceListColumnByColumnDirection[col][i].setHovered(),
122
+ chartInstanceListColumnByColumnDirection[col][i].hideTooltip()) : (isShowTooltip = null === (_b = chartDimensionLinkage.showTooltip) || void 0 === _b || _b,
123
+ isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table), isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table),
124
+ chartInstanceListColumnByColumnDirection[col][i].setHovered(datum), isShowTooltip && chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {
125
+ activeType: "mark"
126
+ })));
127
+ }
128
+ }), 0), table.scenegraph.updateNextFrame();
129
+ }
130
+ }
131
+ }
132
+
133
+ function checkIsShowTooltipForEdgeRow(row, table) {
134
+ var _a, _b;
135
+ let isShowTooltip = !0;
136
+ const {rowStart: rowStart} = table.getBodyVisibleRowRange();
137
+ let rowEnd = table.getBodyVisibleRowRange().rowEnd;
138
+ rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);
139
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
140
+ if (row === rowEnd && isShowTooltip) {
141
+ const heightLimitToShowTooltipForEdgeRow = null !== (_a = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _a ? _a : 0, {rowEnd: rowEnd1} = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);
142
+ if (rowEnd1 === rowEnd) isShowTooltip = !0; else {
143
+ const {rowEnd: rowEnd2} = table.getBodyVisibleRowRange(0, 5);
144
+ isShowTooltip = rowEnd2 !== rowEnd;
145
+ }
146
+ } else if (row === rowStart && isShowTooltip) {
147
+ const heightLimitToShowTooltipForEdgeRow = null !== (_b = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow) && void 0 !== _b ? _b : 0, {rowStart: rowStart1} = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);
148
+ if (rowStart1 === rowStart) isShowTooltip = !0; else {
149
+ const {rowStart: rowStart2} = table.getBodyVisibleRowRange(0, -5);
150
+ isShowTooltip = rowStart2 !== rowStart;
151
+ }
152
+ }
153
+ return isShowTooltip;
154
+ }
155
+
156
+ function checkIsShowTooltipForEdgeColumn(col, table) {
157
+ let isShowTooltip = !0;
158
+ const {colStart: colStart} = table.getBodyVisibleColRange();
159
+ let colEnd = table.getBodyVisibleColRange().colEnd;
160
+ colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);
161
+ const chartDimensionLinkage = table.options.chartDimensionLinkage;
162
+ if (col === colEnd && isShowTooltip) {
163
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colEnd: colEnd1} = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);
164
+ if (colEnd1 === colEnd) isShowTooltip = !0; else {
165
+ const {colEnd: colEnd2} = table.getBodyVisibleColRange(0, 5);
166
+ isShowTooltip = colEnd2 !== colEnd;
167
+ }
168
+ } else if (col === colStart && isShowTooltip) {
169
+ const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn, {colStart: colStart1} = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);
170
+ if (colStart1 === colStart) isShowTooltip = !0; else {
171
+ const {colStart: colStart2} = table.getBodyVisibleColRange(0, -5);
172
+ isShowTooltip = colStart2 !== colStart;
173
+ }
174
+ }
175
+ return isShowTooltip;
176
+ }
177
+
128
178
  export function clearChartInstanceListByRowDirection(row, excludedCol, table) {
129
179
  var _a;
130
180
  if (isValid(chartInstanceListRowByRowDirection[row])) for (const i in chartInstanceListRowByRowDirection[row]) {
@@ -138,4 +188,9 @@ export function clearChartInstanceListByRowDirection(row, excludedCol, table) {
138
188
  }
139
189
  delete chartInstanceListRowByRowDirection[row];
140
190
  }
191
+
192
+ export function clearAllChartInstanceList(table) {
193
+ for (const col in chartInstanceListColumnByColumnDirection) clearChartInstanceListByColumnDirection(Number(col), void 0, table);
194
+ for (const row in chartInstanceListRowByRowDirection) clearChartInstanceListByRowDirection(Number(row), void 0, table);
195
+ }
141
196
  //# sourceMappingURL=active-cell-chart-list.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/graphic/active-cell-chart-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAO3C,MAAM,CAAC,MAAM,wCAAwC,GAAwC,EAAE,CAAC;AAChG,MAAM,CAAC,MAAM,kCAAkC,GAAwC,EAAE,CAAC;AAU1F,MAAM,UAAU,0CAA0C,CACxD,GAAW,EACX,sBAA8B,EAC9B,qBAAsC,EACtC,QAAkC,EAClC,KAAmB,EACnB,cAAuB,KAAK,EAC5B,YAAqB,KAAK;;IAE1B,IAAI,CAAC,OAAO,CAAC,wCAAwC,CAAC,GAAG,CAAC,CAAC,EAAE;QAC3D,wCAAwC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;KACpD;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC,MAAM,CAAC;IACnD,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;I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,CAAC,CAAC;gBACH,kCAAkC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;gBAClD,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;aAC7D;SACF;KACF;IACD,OAAO,kCAAkC,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC","file":"active-cell-chart-list.js","sourcesContent":["import { isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from './chart';\nimport type { PivotChartConstructorOptions } from '../../ts-types/table-engine';\nimport { debug } from 'console';\n\n//存储可视区域内鼠标hover到的该列的图表实例,key为列号做个缓存\nexport const chartInstanceListColumnByColumnDirection: Record<number, Record<number, any>> = {};\nexport const chartInstanceListRowByRowDirection: Record<number, Record<number, any>> = {};\n\n//临时存储 用于调试\n// window.chartInstanceListColumnByColumnDirection = chartInstanceListColumnByColumnDirection;\n// window.chartInstanceListRowByRowDirection = chartInstanceListRowByRowDirection;\n/**\n * 根据列号生成可视区域内图表实例列表\n * @param col 列号\n * @param table 表格实例\n */\nexport function generateChartInstanceListByColumnDirection(\n col: number,\n dimensionValueOrXValue: string,\n positionValueOrYValue: string | number,\n canvasXY: { x: number; y: number },\n table: BaseTableAPI,\n hideTooltip: boolean = false,\n isScatter: boolean = false\n) {\n if (!isValid(chartInstanceListColumnByColumnDirection[col])) {\n chartInstanceListColumnByColumnDirection[col] = {};\n }\n const { rowStart } = table.getBodyVisibleRowRange();\n let rowEnd = table.getBodyVisibleRowRange().rowEnd;\n rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);\n //增加10像素的偏移量,最后一行不是完整显示的chart就不显示tooltip\n for (let i = rowStart; i <= rowEnd; i++) {\n const cellGroup = table.scenegraph.getCell(col, i);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (chartInstanceListColumnByColumnDirection[col][i]) {\n } else if (isValid(chartNode)) {\n if (chartNode.activeChartInstance) {\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n } else {\n chartNode.activate(table);\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n }\n }\n\n setTimeout(() => {\n // 需要等updateNextFrame 触发了chart的drawShape后 设置了数据后 才能触发setDimensionIndex\n if (chartInstanceListColumnByColumnDirection[col]?.[i]) {\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n let isShowTooltip = !isScatter;\n if (!isScatter && typeof chartDimensionLinkage === 'object') {\n isShowTooltip = chartDimensionLinkage.showTooltip ?? true;\n if (i === rowEnd && isShowTooltip) {\n const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;\n const { rowEnd: rowEnd1 } = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);\n if (rowEnd1 === rowEnd) {\n isShowTooltip = true;\n } else {\n const { rowEnd: rowEnd2 } = table.getBodyVisibleRowRange(0, 5);\n if (rowEnd2 !== rowEnd) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n } else if (i === rowStart && isShowTooltip) {\n const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;\n const { rowStart: rowStart1 } = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);\n if (rowStart1 === rowStart) {\n isShowTooltip = true;\n } else {\n const { rowStart: rowStart2 } = table.getBodyVisibleRowRange(0, -5);\n if (rowStart2 !== rowStart) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n }\n }\n //测试代码 用于查看图表实例的id\n // const _21Group = table.scenegraph.getCell(2, 1).firstChild.activeChartInstance;\n // console.log(\n // 'setDimensionIndex column',\n // col,\n // i,\n // chartInstanceListColumnByColumnDirection[col][i].id,\n // _21Group?.id\n // );\n if (isScatter) {\n if (table.stateManager.hover.cellPos.col !== col || table.stateManager.hover.cellPos.row !== i) {\n chartInstanceListColumnByColumnDirection[col][i].showCrosshair?.((axis: any) => {\n // console.log('showCrosshair', axis.layoutOrient, dimensionValueOrXValue);\n if (axis.layoutOrient === 'left') {\n return positionValueOrYValue;\n }\n return dimensionValueOrXValue;\n });\n }\n } else {\n const bodyBoundryTop = table.frozenRowCount\n ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom\n : 0;\n const absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);\n if (hideTooltip) {\n if (table.stateManager.hover.cellPos.col !== col || table.stateManager.hover.cellPos.row !== i) {\n chartInstanceListColumnByColumnDirection[col][i].hideTooltip();\n }\n chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: false,\n showTooltipOption: { x: canvasXY.x, y: absolutePositionTop, activeType: 'dimension' }\n });\n } else {\n chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: isShowTooltip,\n showTooltipOption: { x: canvasXY.x, y: absolutePositionTop, activeType: 'dimension' }\n });\n }\n }\n }\n }, 0);\n\n table.scenegraph.updateNextFrame();\n }\n}\nexport function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI) {\n if (isValid(chartInstanceListColumnByColumnDirection[col])) {\n for (const i in chartInstanceListColumnByColumnDirection[col]) {\n if (isValid(excludedRow) && Number(i) === excludedRow) {\n continue;\n }\n const cellGroup = table.scenegraph.getCell(col, Number(i));\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (isValid(chartNode)) {\n chartNode.deactivate(table, {\n releaseChartInstance: true,\n releaseColumnChartInstance: false,\n releaseRowChartInstance: false\n });\n chartInstanceListColumnByColumnDirection[col][i] = null;\n }\n }\n delete chartInstanceListColumnByColumnDirection[col];\n }\n}\n\n/**\n * 根据行号生成可视区域内图表实例列表\n * @param row 行号\n * @param table 表格实例\n */\nexport function generateChartInstanceListByRowDirection(\n row: number,\n dimensionValueOrXValue: string,\n positionValueOrYValue: string | number,\n canvasXY: { x: number; y: number },\n table: BaseTableAPI,\n hideTooltip: boolean = false,\n isScatter: boolean = false\n) {\n if (!isValid(chartInstanceListRowByRowDirection[row])) {\n chartInstanceListRowByRowDirection[row] = {};\n }\n const { colStart } = table.getBodyVisibleColRange();\n let colEnd = table.getBodyVisibleColRange().colEnd;\n colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);\n for (let i = colStart; i <= colEnd; i++) {\n const cellGroup = table.scenegraph.getCell(i, row);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (chartInstanceListRowByRowDirection[row][i]) {\n } else if (isValid(chartNode)) {\n if (chartNode.activeChartInstance) {\n chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;\n } else {\n chartNode.activate(table);\n chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;\n }\n }\n setTimeout(() => {\n // 需要等updateNextFrame 触发了chart的drawShape后 设置了数据后 才可触发setDimensionIndex绘制出东西 否则会绘制出空的\n if (chartInstanceListRowByRowDirection[row]?.[i]) {\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n let isShowTooltip = !isScatter;\n if (!isScatter && typeof chartDimensionLinkage === 'object') {\n isShowTooltip = chartDimensionLinkage.showTooltip ?? true;\n if (i === colEnd && isShowTooltip) {\n const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;\n const { colEnd: colEnd1 } = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);\n if (colEnd1 === colEnd) {\n isShowTooltip = true;\n } else {\n const { colEnd: colEnd2 } = table.getBodyVisibleColRange(0, 5);\n if (colEnd2 !== colEnd) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n } else if (i === colStart && isShowTooltip) {\n const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;\n const { colStart: colStart1 } = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);\n if (colStart1 === colStart) {\n isShowTooltip = true;\n } else {\n const { colStart: colStart2 } = table.getBodyVisibleColRange(0, -5);\n if (colStart2 !== colStart) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n }\n }\n // console.log('setDimensionIndex row', i, row, chartInstanceListRowByRowDirection[row][i].id);\n if (isScatter) {\n if (table.stateManager.hover.cellPos.col !== i || table.stateManager.hover.cellPos.row !== row) {\n chartInstanceListRowByRowDirection[row][i].showCrosshair?.((axis: any) => {\n if (axis.layoutOrient === 'left') {\n return positionValueOrYValue;\n }\n return dimensionValueOrXValue;\n });\n }\n } else {\n const bodyBoundryLeft = table.frozenColCount\n ? table.getCellRelativeRect(table.frozenColCount - 1, row).right\n : 0;\n const absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);\n if (hideTooltip) {\n if (table.stateManager.hover.cellPos.col !== i || table.stateManager.hover.cellPos.row !== row) {\n console.log('hideTooltip', row, i);\n chartInstanceListRowByRowDirection[row][i].hideTooltip();\n }\n chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: false,\n showTooltipOption: { x: absolutePositionLeft, y: canvasXY.y, activeType: 'dimension' }\n });\n } else {\n chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: isShowTooltip,\n showTooltipOption: { x: absolutePositionLeft, y: canvasXY.y, activeType: 'dimension' }\n });\n }\n }\n }\n }, 0);\n\n table.scenegraph.updateNextFrame();\n }\n}\n\nexport function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI) {\n if (isValid(chartInstanceListRowByRowDirection[row])) {\n for (const i in chartInstanceListRowByRowDirection[row]) {\n if (isValid(excludedCol) && Number(i) === excludedCol) {\n continue;\n }\n const cellGroup = table.scenegraph.getCell(Number(i), row);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (isValid(chartNode)) {\n chartNode.deactivate(table, {\n releaseChartInstance: true,\n releaseColumnChartInstance: false,\n releaseRowChartInstance: false\n });\n chartInstanceListRowByRowDirection[row][i] = null;\n console.log('clearChartInstanceListByRowDirection', row, i);\n }\n }\n }\n delete chartInstanceListRowByRowDirection[row];\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/graphic/active-cell-chart-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAO3C,MAAM,CAAC,MAAM,wCAAwC,GAAwC,EAAE,CAAC;AAChG,MAAM,CAAC,MAAM,kCAAkC,GAAwC,EAAE,CAAC;AAU1F,MAAM,UAAU,0CAA0C,CACxD,GAAW,EACX,sBAA8B,EAC9B,qBAAsC,EACtC,QAAkC,EAClC,KAAmB,EACnB,cAAuB,KAAK,EAC5B,YAAqB,KAAK;;IAE1B,IAAI,CAAC,OAAO,CAAC,wCAAwC,CAAC,GAAG,CAAC,CAAC,EAAE;QAC3D,wCAAwC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;KACpD;IACD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC,MAAM,CAAC;IACnD,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAE3E,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,C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KAAK;oBACjC,uBAAuB,EAAE,KAAK;iBAC/B,CAAC,CAAC;gBACH,kCAAkC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;aACnD;SACF;KACF;IACD,OAAO,kCAAkC,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAmB;IAC3D,KAAK,MAAM,GAAG,IAAI,wCAAwC,EAAE;QAC1D,uCAAuC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;KACxE;IACD,KAAK,MAAM,GAAG,IAAI,kCAAkC,EAAE;QACpD,oCAAoC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;KACrE;AACH,CAAC","file":"active-cell-chart-list.js","sourcesContent":["import { isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from './chart';\nimport type { PivotChartConstructorOptions } from '../../ts-types/table-engine';\nimport { debug } from 'console';\n\n//存储可视区域内鼠标hover到的该列的图表实例,key为列号做个缓存\nexport const chartInstanceListColumnByColumnDirection: Record<number, Record<number, any>> = {};\nexport const chartInstanceListRowByRowDirection: Record<number, Record<number, any>> = {};\n\n//临时存储 用于调试\n// window.chartInstanceListColumnByColumnDirection = chartInstanceListColumnByColumnDirection;\n// window.chartInstanceListRowByRowDirection = chartInstanceListRowByRowDirection;\n/**\n * 根据列号生成可视区域内图表实例列表\n * @param col 列号\n * @param table 表格实例\n */\nexport function generateChartInstanceListByColumnDirection(\n col: number,\n dimensionValueOrXValue: string,\n positionValueOrYValue: string | number,\n canvasXY: { x: number; y: number },\n table: BaseTableAPI,\n hideTooltip: boolean = false,\n isScatter: boolean = false\n) {\n if (!isValid(chartInstanceListColumnByColumnDirection[col])) {\n chartInstanceListColumnByColumnDirection[col] = {};\n }\n const { rowStart } = table.getBodyVisibleRowRange();\n let rowEnd = table.getBodyVisibleRowRange().rowEnd;\n rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);\n //增加10像素的偏移量,最后一行不是完整显示的chart就不显示tooltip\n for (let i = rowStart; i <= rowEnd; i++) {\n const cellGroup = table.scenegraph.getCell(col, i);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (chartInstanceListColumnByColumnDirection[col][i]) {\n } else if (isValid(chartNode)) {\n if (chartNode.activeChartInstance) {\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n } else {\n chartNode.activate(table);\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n }\n }\n\n setTimeout(() => {\n // 需要等updateNextFrame 触发了chart的drawShape后 设置了数据后 才能触发setDimensionIndex\n if (chartInstanceListColumnByColumnDirection[col]?.[i]) {\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n let isShowTooltip = !isScatter;\n if (!isScatter && typeof chartDimensionLinkage === 'object') {\n isShowTooltip = chartDimensionLinkage.showTooltip ?? true;\n isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table);\n }\n //测试代码 用于查看图表实例的id\n // const _21Group = table.scenegraph.getCell(2, 1).firstChild.activeChartInstance;\n // console.log(\n // 'setDimensionIndex column',\n // col,\n // i,\n // chartInstanceListColumnByColumnDirection[col][i].id,\n // _21Group?.id\n // );\n if (isScatter) {\n if (table.stateManager.hover.cellPos.col !== col || table.stateManager.hover.cellPos.row !== i) {\n chartInstanceListColumnByColumnDirection[col][i].showCrosshair?.((axis: any) => {\n // console.log('showCrosshair', axis.layoutOrient, dimensionValueOrXValue);\n if (axis.layoutOrient === 'left') {\n return positionValueOrYValue;\n }\n return dimensionValueOrXValue;\n });\n }\n } else {\n const cellBoundry = table.getCellRelativeRect(col, i);\n const bodyBoundryTop = table.frozenRowCount\n ? table.getCellRelativeRect(col, table.frozenRowCount - 1).bottom\n : 0;\n const absolutePositionTop = Math.max(bodyBoundryTop, table.getCellRelativeRect(col, i).top);\n if (hideTooltip) {\n if (table.stateManager.hover.cellPos.col !== col || table.stateManager.hover.cellPos.row !== i) {\n chartInstanceListColumnByColumnDirection[col][i].hideTooltip();\n }\n chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: false,\n showTooltipOption: {\n x: canvasXY.x - cellBoundry.left,\n y: absolutePositionTop - cellBoundry.top,\n activeType: 'dimension'\n }\n });\n } else {\n chartInstanceListColumnByColumnDirection[col][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: isShowTooltip,\n showTooltipOption: {\n x: canvasXY.x - cellBoundry.left,\n y: absolutePositionTop - cellBoundry.top,\n activeType: 'dimension'\n }\n });\n }\n }\n }\n }, 0);\n\n table.scenegraph.updateNextFrame();\n }\n}\nexport function clearChartInstanceListByColumnDirection(col: number, excludedRow: number, table: BaseTableAPI) {\n if (isValid(chartInstanceListColumnByColumnDirection[col])) {\n for (const i in chartInstanceListColumnByColumnDirection[col]) {\n if (isValid(excludedRow) && Number(i) === excludedRow) {\n continue;\n }\n const cellGroup = table.scenegraph.getCell(col, Number(i));\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (isValid(chartNode)) {\n chartNode.deactivate(table, {\n releaseChartInstance: true,\n releaseColumnChartInstance: false,\n releaseRowChartInstance: false\n });\n chartInstanceListColumnByColumnDirection[col][i] = null;\n }\n }\n delete chartInstanceListColumnByColumnDirection[col];\n }\n}\n\n/**\n * 根据行号生成可视区域内图表实例列表\n * @param row 行号\n * @param table 表格实例\n */\nexport function generateChartInstanceListByRowDirection(\n row: number,\n dimensionValueOrXValue: string,\n positionValueOrYValue: string | number,\n canvasXY: { x: number; y: number },\n table: BaseTableAPI,\n hideTooltip: boolean = false,\n isScatter: boolean = false\n) {\n if (!isValid(chartInstanceListRowByRowDirection[row])) {\n chartInstanceListRowByRowDirection[row] = {};\n }\n const { colStart } = table.getBodyVisibleColRange();\n let colEnd = table.getBodyVisibleColRange().colEnd;\n colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);\n for (let i = colStart; i <= colEnd; i++) {\n const cellGroup = table.scenegraph.getCell(i, row);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (chartInstanceListRowByRowDirection[row][i]) {\n } else if (isValid(chartNode)) {\n if (chartNode.activeChartInstance) {\n chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;\n } else {\n chartNode.activate(table);\n chartInstanceListRowByRowDirection[row][i] = chartNode.activeChartInstance;\n }\n }\n setTimeout(() => {\n // 需要等updateNextFrame 触发了chart的drawShape后 设置了数据后 才可触发setDimensionIndex绘制出东西 否则会绘制出空的\n if (chartInstanceListRowByRowDirection[row]?.[i]) {\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n let isShowTooltip = !isScatter;\n if (!isScatter && typeof chartDimensionLinkage === 'object') {\n isShowTooltip = chartDimensionLinkage.showTooltip ?? true;\n isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(i, table);\n }\n // console.log('setDimensionIndex row', i, row, chartInstanceListRowByRowDirection[row][i].id);\n if (isScatter) {\n if (table.stateManager.hover.cellPos.col !== i || table.stateManager.hover.cellPos.row !== row) {\n chartInstanceListRowByRowDirection[row][i].showCrosshair?.((axis: any) => {\n if (axis.layoutOrient === 'left') {\n return positionValueOrYValue;\n }\n return dimensionValueOrXValue;\n });\n }\n } else {\n const cellBoundry = table.getCellRelativeRect(i, row);\n const bodyBoundryLeft = table.frozenColCount\n ? table.getCellRelativeRect(table.frozenColCount - 1, row).right\n : 0;\n const absolutePositionLeft = Math.max(bodyBoundryLeft, table.getCellRelativeRect(i, row).left);\n if (hideTooltip) {\n if (table.stateManager.hover.cellPos.col !== i || table.stateManager.hover.cellPos.row !== row) {\n chartInstanceListRowByRowDirection[row][i].hideTooltip();\n }\n chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: false,\n showTooltipOption: {\n x: absolutePositionLeft - cellBoundry.left,\n y: canvasXY.y - cellBoundry.top,\n activeType: 'dimension'\n }\n });\n } else {\n chartInstanceListRowByRowDirection[row][i].setDimensionIndex(dimensionValueOrXValue, {\n tooltip: isShowTooltip,\n showTooltipOption: {\n x: absolutePositionLeft - cellBoundry.left,\n y: canvasXY.y - cellBoundry.top,\n activeType: 'dimension'\n }\n });\n }\n }\n }\n }, 0);\n\n table.scenegraph.updateNextFrame();\n }\n}\nexport function generateChartInstanceListByViewRange(datum: any, table: BaseTableAPI, deactivate: boolean = false) {\n const { rowStart } = table.getBodyVisibleRowRange();\n let rowEnd = table.getBodyVisibleRowRange().rowEnd;\n rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);\n const { colStart } = table.getBodyVisibleColRange();\n let colEnd = table.getBodyVisibleColRange().colEnd;\n colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);\n //增加10像素的偏移量,最后一行不是完整显示的chart就不显示tooltip\n for (let col = colStart; col <= colEnd; col++) {\n if (!isValid(chartInstanceListColumnByColumnDirection[col])) {\n chartInstanceListColumnByColumnDirection[col] = {};\n }\n for (let i = rowStart; i <= rowEnd; i++) {\n const cellGroup = table.scenegraph.getCell(col, i);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (chartInstanceListColumnByColumnDirection[col][i]) {\n } else if (isValid(chartNode)) {\n if (chartNode.activeChartInstance) {\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n } else {\n if (chartNode.attribute.spec.type === 'pie') {\n chartNode.activate(table);\n chartInstanceListColumnByColumnDirection[col][i] = chartNode.activeChartInstance;\n }\n }\n }\n\n setTimeout(() => {\n // 需要等updateNextFrame 触发了chart的drawShape后 设置了数据后 才能触发setDimensionIndex\n if (chartInstanceListColumnByColumnDirection[col]?.[i]) {\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n let isShowTooltip = true;\n if (typeof chartDimensionLinkage === 'object') {\n if (deactivate) {\n chartInstanceListColumnByColumnDirection[col][i].setHovered();\n chartInstanceListColumnByColumnDirection[col][i].hideTooltip();\n } else {\n isShowTooltip = chartDimensionLinkage.showTooltip ?? true;\n isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeRow(i, table);\n isShowTooltip = isShowTooltip && checkIsShowTooltipForEdgeColumn(col, table);\n chartInstanceListColumnByColumnDirection[col][i].setHovered(datum);\n isShowTooltip &&\n chartInstanceListColumnByColumnDirection[col][i].showTooltip(datum, {\n activeType: 'mark'\n });\n }\n }\n }\n }, 0);\n\n table.scenegraph.updateNextFrame();\n }\n }\n}\nfunction checkIsShowTooltipForEdgeRow(row: number, table: BaseTableAPI) {\n let isShowTooltip = true;\n const { rowStart } = table.getBodyVisibleRowRange();\n let rowEnd = table.getBodyVisibleRowRange().rowEnd;\n rowEnd = Math.min(table.rowCount - 1 - table.bottomFrozenRowCount, rowEnd);\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n if (row === rowEnd && isShowTooltip) {\n const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;\n const { rowEnd: rowEnd1 } = table.getBodyVisibleRowRange(0, -heightLimitToShowTooltipForEdgeRow);\n if (rowEnd1 === rowEnd) {\n isShowTooltip = true;\n } else {\n const { rowEnd: rowEnd2 } = table.getBodyVisibleRowRange(0, 5);\n if (rowEnd2 !== rowEnd) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n } else if (row === rowStart && isShowTooltip) {\n const heightLimitToShowTooltipForEdgeRow = chartDimensionLinkage.heightLimitToShowTooltipForEdgeRow ?? 0;\n const { rowStart: rowStart1 } = table.getBodyVisibleRowRange(heightLimitToShowTooltipForEdgeRow, 0);\n if (rowStart1 === rowStart) {\n isShowTooltip = true;\n } else {\n const { rowStart: rowStart2 } = table.getBodyVisibleRowRange(0, -5);\n if (rowStart2 !== rowStart) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n }\n return isShowTooltip;\n}\n\n/**\n * 检查是否显示tooltip 用于检查是否边缘列,且单元格被滚动遮挡只显示一部分的情况下,检测该图表显示出来至少多宽 可允许显示tooltip。\n * @param col 列号\n * @param table 表格实例\n * @returns 是否显示tooltip\n * @returns\n */\nfunction checkIsShowTooltipForEdgeColumn(col: number, table: BaseTableAPI) {\n let isShowTooltip = true;\n const { colStart } = table.getBodyVisibleColRange();\n let colEnd = table.getBodyVisibleColRange().colEnd;\n colEnd = Math.min(table.colCount - 1 - table.rightFrozenColCount, colEnd);\n const chartDimensionLinkage = (table.options as PivotChartConstructorOptions).chartDimensionLinkage;\n if (col === colEnd && isShowTooltip) {\n const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;\n const { colEnd: colEnd1 } = table.getBodyVisibleColRange(0, -widthLimitToShowTooltipForEdgeColumn);\n if (colEnd1 === colEnd) {\n isShowTooltip = true;\n } else {\n const { colEnd: colEnd2 } = table.getBodyVisibleColRange(0, 5);\n if (colEnd2 !== colEnd) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n } else if (col === colStart && isShowTooltip) {\n const widthLimitToShowTooltipForEdgeColumn = chartDimensionLinkage.widthLimitToShowTooltipForEdgeColumn;\n const { colStart: colStart1 } = table.getBodyVisibleColRange(widthLimitToShowTooltipForEdgeColumn, 0);\n if (colStart1 === colStart) {\n isShowTooltip = true;\n } else {\n const { colStart: colStart2 } = table.getBodyVisibleColRange(0, -5);\n if (colStart2 !== colStart) {\n isShowTooltip = true;\n } else {\n isShowTooltip = false;\n }\n }\n }\n return isShowTooltip;\n}\n/**\n * 检查是否显示tooltip 用于检查是否边缘行,且单元格被滚动遮挡只显示一部分的情况下,检测该图表显示出来至少多高 可允许显示tooltip。\n * @param row 行号\n * @param table 表格实例\n * @returns 是否显示tooltip\n * @returns\n */\nexport function clearChartInstanceListByRowDirection(row: number, excludedCol: number, table: BaseTableAPI) {\n if (isValid(chartInstanceListRowByRowDirection[row])) {\n for (const i in chartInstanceListRowByRowDirection[row]) {\n if (isValid(excludedCol) && Number(i) === excludedCol) {\n continue;\n }\n const cellGroup = table.scenegraph.getCell(Number(i), row);\n const chartNode = cellGroup?.getChildren()?.[0] as Chart;\n chartNode.addUpdateShapeAndBoundsTag();\n if (isValid(chartNode)) {\n chartNode.deactivate(table, {\n releaseChartInstance: true,\n releaseColumnChartInstance: false,\n releaseRowChartInstance: false\n });\n chartInstanceListRowByRowDirection[row][i] = null;\n }\n }\n }\n delete chartInstanceListRowByRowDirection[row];\n}\n\nexport function clearAllChartInstanceList(table: BaseTableAPI) {\n for (const col in chartInstanceListColumnByColumnDirection) {\n clearChartInstanceListByColumnDirection(Number(col), undefined, table);\n }\n for (const row in chartInstanceListRowByRowDirection) {\n clearChartInstanceListByRowDirection(Number(row), undefined, table);\n }\n}\n"]}
@@ -24,6 +24,12 @@ export declare class Chart extends Rect {
24
24
  attribute: IChartGraphicAttribute;
25
25
  chartInstance: any;
26
26
  activeChartInstance: any;
27
+ activeChartInstanceLastViewBox: {
28
+ x1: number;
29
+ y1: number;
30
+ x2: number;
31
+ y2: number;
32
+ };
27
33
  activeChartInstanceHoverOnMark: any;
28
34
  justShowMarkTooltip: boolean;
29
35
  justShowMarkTooltipTimer: number;
@@ -39,10 +45,11 @@ export declare class Chart extends Rect {
39
45
  constructor(isShareChartSpec: boolean, params: IChartGraphicAttribute);
40
46
  activate(table: BaseTableAPI): void;
41
47
  static temp: number;
42
- deactivate(table: BaseTableAPI, { releaseChartInstance, releaseColumnChartInstance, releaseRowChartInstance }?: {
48
+ deactivate(table: BaseTableAPI, { releaseChartInstance, releaseColumnChartInstance, releaseRowChartInstance, releaseAllChartInstance }?: {
43
49
  releaseChartInstance?: boolean;
44
50
  releaseColumnChartInstance?: boolean;
45
51
  releaseRowChartInstance?: boolean;
52
+ releaseAllChartInstance?: boolean;
46
53
  }): void;
47
54
  updateData(data: any): void;
48
55
  getViewBox(): {
@@ -4,17 +4,20 @@ import { Bounds, merge } from "@visactor/vutils";
4
4
 
5
5
  import { getCellHoverColor } from "../../state/hover/is-cell-hover";
6
6
 
7
- import { clearChartInstanceListByColumnDirection, clearChartInstanceListByRowDirection, generateChartInstanceListByColumnDirection, generateChartInstanceListByRowDirection } from "./active-cell-chart-list";
7
+ import { clearAllChartInstanceList, clearChartInstanceListByColumnDirection, clearChartInstanceListByRowDirection, generateChartInstanceListByColumnDirection, generateChartInstanceListByRowDirection, generateChartInstanceListByViewRange } from "./active-cell-chart-list";
8
8
 
9
9
  import { getAxisConfigInPivotChart } from "../../layout/chart-helper/get-axis-config";
10
10
 
11
+ import { cancellableThrottle } from "../../tools/util";
12
+
11
13
  export const CHART_NUMBER_TYPE = genNumberType();
12
14
 
13
15
  export class Chart extends Rect {
14
16
  constructor(isShareChartSpec, params) {
15
- if (super(params), this.type = "chart", this.activeChartInstanceHoverOnMark = null,
16
- this.justShowMarkTooltip = void 0, this.justShowMarkTooltipTimer = Date.now(), this.delayRunDimensionHoverTimer = void 0,
17
- this.numberType = CHART_NUMBER_TYPE, this.isShareChartSpec = isShareChartSpec, params.chartInstance) this.chartInstance = params.chartInstance; else {
17
+ if (super(params), this.type = "chart", this.activeChartInstanceLastViewBox = null,
18
+ this.activeChartInstanceHoverOnMark = null, this.justShowMarkTooltip = void 0, this.justShowMarkTooltipTimer = Date.now(),
19
+ this.delayRunDimensionHoverTimer = void 0, this.numberType = CHART_NUMBER_TYPE,
20
+ this.isShareChartSpec = isShareChartSpec, params.chartInstance) this.chartInstance = params.chartInstance; else {
18
21
  const chartInstance = this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
19
22
  renderCanvas: params.canvas,
20
23
  mode: "node" === this.attribute.mode ? "node" : "desktop-browser",
@@ -35,7 +38,7 @@ export class Chart extends Rect {
35
38
  }
36
39
  }
37
40
  activate(table) {
38
- var _a, _b, _c, _d, _e;
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
39
42
  if (this.activeChartInstance) return;
40
43
  const {col: col, row: row} = this.parent, hoverColor = getCellHoverColor(this.parent, table), {x1: x1, y1: y1, x2: x2, y2: y2} = this.getViewBox(), clipBound = getTableBounds(col, row, table).intersect({
41
44
  x1: x1 - table.scrollLeft,
@@ -77,7 +80,7 @@ export class Chart extends Rect {
77
80
  context.fill());
78
81
  }
79
82
  },
80
- componentShowContent: table.options.chartDimensionLinkage && "scatter" !== this.attribute.spec.type ? {
83
+ componentShowContent: (null === (_b = table.options.chartDimensionLinkage) || void 0 === _b ? void 0 : _b.showTooltip) && "scatter" !== this.attribute.spec.type ? {
81
84
  tooltip: {
82
85
  dimension: !1,
83
86
  mark: !0
@@ -86,19 +89,40 @@ export class Chart extends Rect {
86
89
  } : void 0
87
90
  }));
88
91
  const chartStage = this.activeChartInstance.getStage(), matrix = this.globalTransMatrix.clone(), stageMatrix = this.stage.window.getViewBoxTransform();
92
+ let brushChangeThrottle;
89
93
  matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f),
90
94
  chartStage.window.setViewBoxTransform && chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f),
91
- this.activeChartInstance.renderSync(), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, this.activeChartInstance),
95
+ this.activeChartInstance.renderSync(), null === (_d = null === (_c = table.internalProps.layoutMap) || void 0 === _c ? void 0 : _c.updateDataStateToActiveChartInstance) || void 0 === _d || _d.call(_c, this.activeChartInstance),
92
96
  this.activeChartInstance.on("click", (params => {
93
97
  var _a;
94
- !1 === (null === (_a = this.attribute.spec.select) || void 0 === _a ? void 0 : _a.enable) ? table.scenegraph.updateChartState(null) : Chart.temp && table.scenegraph.updateChartState(null == params ? void 0 : params.datum);
95
- })), this.activeChartInstance.on("brushEnd", (params => {
98
+ !1 === (null === (_a = this.attribute.spec.select) || void 0 === _a ? void 0 : _a.enable) ? table.scenegraph.updateChartState(null, void 0) : Chart.temp && table.scenegraph.updateChartState(null == params ? void 0 : params.datum, "click");
99
+ })), (null === (_e = table.options.chartDimensionLinkage) || void 0 === _e ? void 0 : _e.listenBrushChange) && (brushChangeThrottle = cancellableThrottle(table.scenegraph.updateChartState.bind(table.scenegraph), null !== (_g = null === (_f = table.options.chartDimensionLinkage) || void 0 === _f ? void 0 : _f.brushChangeDelay) && void 0 !== _g ? _g : 100),
100
+ this.activeChartInstance.on("brushChange", (params => {
101
+ var _a;
102
+ brushChangeThrottle.throttled(null === (_a = null == params ? void 0 : params.value) || void 0 === _a ? void 0 : _a.inBrushData, "brush");
103
+ }))), this.activeChartInstance.on("brushEnd", (params => {
96
104
  var _a;
97
- table.scenegraph.updateChartState(null === (_a = null == params ? void 0 : params.value) || void 0 === _a ? void 0 : _a.inBrushData),
105
+ null == brushChangeThrottle || brushChangeThrottle.cancel(), table.scenegraph.updateChartState(null === (_a = null == params ? void 0 : params.value) || void 0 === _a ? void 0 : _a.inBrushData, "brush"),
98
106
  Chart.temp = 0, setTimeout((() => {
99
107
  Chart.temp = 1;
100
108
  }), 0);
101
- })), table.options.chartDimensionLinkage && this.activeChartInstance.on("dimensionHover", (params => {
109
+ })), (null === (_h = table.options.chartDimensionLinkage) || void 0 === _h ? void 0 : _h.showTooltip) && ("pie" === this.attribute.spec.type && (this.activeChartInstance.on("pointerover", {
110
+ markName: "pie"
111
+ }, (params => {
112
+ var _a;
113
+ const categoryField = this.attribute.spec.categoryField, datum = {
114
+ [categoryField]: null === (_a = null == params ? void 0 : params.datum) || void 0 === _a ? void 0 : _a[categoryField]
115
+ };
116
+ generateChartInstanceListByViewRange(datum, table, !1);
117
+ })), this.activeChartInstance.on("pointerout", {
118
+ markName: "pie"
119
+ }, (params => {
120
+ var _a;
121
+ const categoryField = this.attribute.spec.categoryField, datum = {
122
+ [categoryField]: null === (_a = null == params ? void 0 : params.datum) || void 0 === _a ? void 0 : _a[categoryField]
123
+ };
124
+ generateChartInstanceListByViewRange(datum, table, !0);
125
+ }))), this.activeChartInstance.on("dimensionHover", (params => {
102
126
  var _a, _b;
103
127
  const dimensionInfo = null == params ? void 0 : params.dimensionInfo[0], canvasXY = null === (_a = null == params ? void 0 : params.event) || void 0 === _a ? void 0 : _a.canvas, viewport = null === (_b = null == params ? void 0 : params.event) || void 0 === _b ? void 0 : _b.viewport;
104
128
  if (viewport) {
@@ -153,9 +177,9 @@ export class Chart extends Rect {
153
177
  }
154
178
  }
155
179
  }
156
- })), null === (_e = (_d = table)._bindChartEvent) || void 0 === _e || _e.call(_d, this.activeChartInstance);
180
+ }))), null === (_k = (_j = table)._bindChartEvent) || void 0 === _k || _k.call(_j, this.activeChartInstance);
157
181
  }
158
- deactivate(table, {releaseChartInstance: releaseChartInstance = !0, releaseColumnChartInstance: releaseColumnChartInstance = !0, releaseRowChartInstance: releaseRowChartInstance = !0} = {}) {
182
+ deactivate(table, {releaseChartInstance: releaseChartInstance = !0, releaseColumnChartInstance: releaseColumnChartInstance = !0, releaseRowChartInstance: releaseRowChartInstance = !0, releaseAllChartInstance: releaseAllChartInstance = !1} = {}) {
159
183
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
160
184
  if (this.activeChartInstanceHoverOnMark = null, this.justShowMarkTooltip = void 0,
161
185
  this.justShowMarkTooltipTimer = Date.now(), clearTimeout(this.delayRunDimensionHoverTimer),
@@ -175,21 +199,22 @@ export class Chart extends Rect {
175
199
  releaseColumnChartInstance && table.internalProps.layoutMap.isAxisCell(col, table.rowCount - table.bottomFrozenRowCount) && (null === (_h = null === (_g = table.scenegraph.getCell(col, table.rowCount - table.bottomFrozenRowCount).firstChild) || void 0 === _g ? void 0 : _g.hideLabelHoverOnAxis) || void 0 === _h || _h.call(_g)),
176
200
  releaseRowChartInstance && table.internalProps.layoutMap.isAxisCell(table.rowHeaderLevelCount - 1, row) && (null === (_k = null === (_j = table.scenegraph.getCell(table.rowHeaderLevelCount - 1, row).firstChild) || void 0 === _j ? void 0 : _j.hideLabelHoverOnAxis) || void 0 === _k || _k.call(_j));
177
201
  }
178
- releaseColumnChartInstance && clearChartInstanceListByColumnDirection(this.parent.col, "scatter" === this.attribute.spec.type ? this.parent.row : void 0, table),
179
- releaseRowChartInstance && clearChartInstanceListByRowDirection(this.parent.row, "scatter" === this.attribute.spec.type ? this.parent.col : void 0, table);
202
+ releaseAllChartInstance ? clearAllChartInstanceList(table) : (releaseColumnChartInstance && clearChartInstanceListByColumnDirection(this.parent.col, "scatter" === this.attribute.spec.type ? this.parent.row : void 0, table),
203
+ releaseRowChartInstance && clearChartInstanceListByRowDirection(this.parent.row, "scatter" === this.attribute.spec.type ? this.parent.col : void 0, table));
180
204
  }
181
205
  updateData(data) {
182
206
  this.attribute.data = data;
183
207
  }
184
208
  getViewBox() {
185
209
  var _a, _b, _c, _d, _e, _f, _g, _h;
186
- const cellGroup = this.parent, padding = this.attribute.cellPadding, table = this.stage.table, {x1: x1, y1: y1, x2: x2, y2: y2} = cellGroup.globalAABBBounds;
187
- return {
210
+ const cellGroup = this.parent, padding = this.attribute.cellPadding, table = this.stage.table, {x1: x1, y1: y1, x2: x2, y2: y2} = cellGroup.globalAABBBounds, viewBox = {
188
211
  x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (null !== (_b = null === (_a = table.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0)),
189
212
  x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (null !== (_d = null === (_c = table.options.viewBox) || void 0 === _c ? void 0 : _c.x1) && void 0 !== _d ? _d : 0)),
190
213
  y1: Math.ceil(y1 + padding[0] + table.scrollTop + (null !== (_f = null === (_e = table.options.viewBox) || void 0 === _e ? void 0 : _e.y1) && void 0 !== _f ? _f : 0)),
191
214
  y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (null !== (_h = null === (_g = table.options.viewBox) || void 0 === _g ? void 0 : _g.y1) && void 0 !== _h ? _h : 0))
192
215
  };
216
+ return this.activeChartInstance ? this.activeChartInstanceLastViewBox = viewBox : this.activeChartInstanceLastViewBox = null,
217
+ viewBox;
193
218
  }
194
219
  }
195
220