@visactor/vtable 1.5.5-beta.0 → 1.5.6
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.
- package/cjs/ListTable.js +1 -1
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.js +1 -1
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.js +1 -1
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +75 -29
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -1
- package/cjs/scenegraph/scenegraph.js +3 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/resize/update-resize-row.js +1 -1
- package/cjs/state/resize/update-resize-row.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/state/state.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +147 -58
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +1 -1
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.js +1 -1
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
- package/es/scenegraph/graphic/chart.js +1 -1
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +75 -29
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -1
- package/es/scenegraph/scenegraph.js +3 -3
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/resize/update-resize-row.js +1 -1
- package/es/state/resize/update-resize-row.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/state/state.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/es/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { getDataCellPath } from './tools/get-data-path';
|
|
|
20
20
|
export * from './render/jsx';
|
|
21
21
|
export { getTargetCell } from './event/util';
|
|
22
22
|
import * as VRender from './vrender';
|
|
23
|
-
export declare const version = "1.5.
|
|
23
|
+
export declare const version = "1.5.6";
|
|
24
24
|
export { TYPES, core, ListTable, ListTableSimple, ListTableConstructorOptions, PivotTable, PivotTableSimple, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, IHeaderTreeDefine, IDimension, IIndicator, ITitleDefine, ICornerDefine, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout, updateCell, renderChart, graphicUtil, setCustomAlphabetCharSet, restoreMeasureText, VRender };
|
|
25
25
|
declare function getIcons(): {
|
|
26
26
|
[key: string]: TYPES.ColumnIconOption;
|
package/es/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { getTargetCell } from "./event/util";
|
|
|
42
42
|
|
|
43
43
|
import * as VRender from "./vrender";
|
|
44
44
|
|
|
45
|
-
export const version = "1.5.
|
|
45
|
+
export const version = "1.5.6";
|
|
46
46
|
|
|
47
47
|
export { TYPES, core, ListTable, ListTableSimple, PivotTable, PivotTableSimple, PivotChart, themes, data, getIcons, clearGlobal, register, DataStatistics, CustomLayout, updateCell, renderChart, graphicUtil, setCustomAlphabetCharSet, restoreMeasureText, VRender };
|
|
48
48
|
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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AY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACR,CAAC;AAGF,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AACD,KAAK,CAAC,eAAe,CAAC;AAEtB,cAAc,cAAc,CAAC;AAC7B,cAAc,sCAAsC,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil, registerForVrender } from './vrender';\nregisterForVrender();\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTableAll as ListTable } from './ListTable-all';\nimport { ListTableSimple } from './ListTable-simple';\n// import { PivotTable } from './PivotTable';\nimport { PivotTableAll as PivotTable } from './PivotTable-all';\nimport { PivotTableSimple } from './PivotTable-simple';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\nimport { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils/text-measure';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\nexport { getTargetCell } from './event/util';\n\n// export * as VRender from './vrender';\nimport * as VRender from './vrender';\n\nexport const version = \"1.5.6\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableSimple,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableSimple,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n graphicUtil,\n setCustomAlphabetCharSet,\n restoreMeasureText,\n VRender\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n\nexport * from './components';\nexport * from './scenegraph/group-creater/cell-type';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/debug-tool/debug-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAW9C,MAAM,OAAO,SAAS;IAgBpB,YAAY,KAAa,EAAE,OAA0B;QAVrD,UAAK,GAAsB,OAAO,CAAC;QAWjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI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;YAC5C,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;gBACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC3B;iBAAM,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;gBACxB,QAAQ,IAAI,CAAC,KAAK,EAAE;oBAClB,KAAK,OAAO;wBACV,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;wBACrB,MAAM;oBACR,KAAK,OAAO;wBACV,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;wBACrB,MAAM;iBACT;gBACD,IAAI,CAAC,UAAU,EAAE,CAAC;aACnB;QACH,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO;QAEL,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAG/C,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAInE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAG7E,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CACF","file":"debug-tool.js","sourcesContent":["import type { FederatedPointerEvent, IStage, IRect, IGraphic } from './../../vrender';\nimport { createRect, getTheme } from './../../vrender';\nimport JSONFormatter from 'json-formatter-js';\n\nexport interface DebugToolOptions {\n container?: HTMLElement;\n infoPosition?: 'tl' | 'tr' | 'bl' | 'br';\n infoWidth?: number;\n infoHeight?: number;\n mode?: 'hover' | 'click';\n customGrapicKeys?: string[];\n}\n\nexport class DebugTool {\n _stage: IStage;\n _infoContainer: HTMLElement;\n _highlightRect: HTMLElement;\n _target: IGraphic;\n // _rect: IRect;\n _mode: 'hover' | 'click' = 'hover';\n _customGrapicKeys?: string[];\n _modeTip: HTMLElement;\n _callback: {\n pointermove: (e: FederatedPointerEvent) => void;\n pointerup: (e: FederatedPointerEvent) => void;\n pointerleave: (e: FederatedPointerEvent) => void;\n keydown: (e: KeyboardEvent) => void;\n };\n\n constructor(stage: IStage, options?: DebugToolOptions) {\n this._stage = stage;\n this._callback = {} as any;\n\n if (options?.customGrapicKeys) {\n this._customGrapicKeys = options.customGrapicKeys;\n }\n\n // 创建信息框\n if (options?.container) {\n this._infoContainer = options.container;\n } else {\n this.createInfoContainer(options);\n }\n\n // 创建高亮矩形\n this.createHighlightRect();\n\n // 绑定stage事件\n this.bindStageEvent();\n\n // 绑定键盘事件\n this.bindKeyEvent();\n }\n\n createInfoContainer(options?: DebugToolOptions) {\n const position = options?.infoPosition || 'tr';\n const width = options?.infoWidth || 300;\n const height = options?.infoPosition || 400;\n this._infoContainer = document.createElement('div');\n this._infoContainer.style.position = 'fixed';\n this._infoContainer.style.width = `${width}px`;\n this._infoContainer.style.height = `${height}px`;\n this._infoContainer.style.backgroundColor = 'rgba(210, 210, 210, 0.3)';\n this._infoContainer.style.overflow = 'auto';\n this._infoContainer.style.display = 'none';\n switch (position) {\n case 'tl':\n this._infoContainer.style.top = '0px';\n this._infoContainer.style.left = '0px';\n break;\n case 'tr':\n this._infoContainer.style.top = '0px';\n this._infoContainer.style.right = `0px`;\n break;\n case 'bl':\n this._infoContainer.style.bottom = `0px`;\n this._infoContainer.style.left = '0px';\n break;\n case 'br':\n this._infoContainer.style.bottom = `0px`;\n this._infoContainer.style.right = `0px`;\n break;\n }\n\n // Tip\n // debug 模式:hover(shift + s改变模式;shift + d控制台输出target graphic)\n const tip = document.createElement('div');\n const tipSpan1 = document.createElement('span');\n tipSpan1.innerText = 'debug 模式:';\n tip.appendChild(tipSpan1);\n this._modeTip = document.createElement('span');\n this._modeTip.innerText = this._mode;\n tip.appendChild(this._modeTip);\n const tipSpan2 = document.createElement('span');\n tipSpan2.innerText = '(shift + s改变模式;shift + d控制台输出target graphic)';\n tip.appendChild(tipSpan2);\n this._infoContainer.appendChild(tip);\n\n // document.body.append(this._infoContainer);\n this._stage.window.getContainer().append(this._infoContainer);\n }\n\n createHighlightRect() {\n const container = this._stage.window.getContainer();\n this._highlightRect = document.createElement('div');\n this._highlightRect.style.display = 'absolute';\n this._highlightRect.style.border = '1px solid red';\n this._highlightRect.style.pointerEvents = 'none';\n this._highlightRect.style.position = 'absolute';\n container.appendChild(this._highlightRect);\n }\n\n bindStageEvent() {\n this._callback.pointermove = (e: FederatedPointerEvent) => {\n if (this._mode !== 'hover') {\n // do nothing\n } else if (e.target && (e.target as unknown as IGraphic) !== this._target) {\n // 更新bounds\n this._target = e.target as unknown as IGraphic;\n this.addHighlightBounds(this._target.globalAABBBounds);\n setTimeout(() => {\n this.updateInfo();\n }, 100);\n } else if (!e.target) {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointermove', this._callback.pointermove);\n\n this._callback.pointerup = (e: FederatedPointerEvent) => {\n if (this._mode !== 'click') {\n // do nothing\n } else if (e.target && (e.target as unknown as IGraphic) !== this._target) {\n // 更新bounds\n this._target = e.target as unknown as IGraphic;\n this.addHighlightBounds(this._target.globalAABBBounds);\n setTimeout(() => {\n this.updateInfo();\n }, 100);\n } else if (!e.target) {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointerup', this._callback.pointerup);\n\n this._callback.pointerleave = (e: FederatedPointerEvent) => {\n if (this._mode === 'hover') {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointerleave', this._callback.pointerleave);\n }\n\n addHighlightBounds(bounds: any) {\n // 使用VRender绘制高亮框会导致触发多余渲染,因此使用dom\n // this._rect.setAttributes({\n // x: bounds.x1,\n // y: bounds.y1,\n // width: bounds.width(),\n // height: bounds.height(),\n // visible: true,\n // });\n\n // // 保证rect在最上层\n // this._stage.defaultLayer.appendChild(this._rect);\n // this._stage.renderNextFrame();\n\n const table = (this._stage as any).table;\n const stage = table.scenegraph.stage;\n const stageMatrix = stage.window.getViewBoxTransform();\n\n this._highlightRect.style.left = `${bounds.x1 + (stageMatrix.e ?? 0) + (table.options.viewBox?.x1 ?? 0)}px`;\n this._highlightRect.style.top = `${bounds.y1 + (stageMatrix.f ?? 0) + (table.options.viewBox?.y1 ?? 0)}px`;\n this._highlightRect.style.width = `${bounds.width()}px`;\n this._highlightRect.style.height = `${bounds.height()}px`;\n\n console.log(this._highlightRect.style.left);\n }\n\n // removeHighlightBounds() {\n // this._rect.setAttribute('visible', false);\n // this._stage.renderNextFrame();\n // }\n\n updateInfo() {\n if (!this._target) {\n return;\n }\n // this._infoContainer.innerHTML = '';\n if (this._infoContainer.children.length > 1) {\n this._infoContainer.removeChild(this._infoContainer.children[1]);\n }\n this._infoContainer.style.display = 'block';\n\n const info = {\n customKeys: {},\n type: this._target.type,\n // role: (this._target as any).role,\n globalX: this._target.globalTransMatrix.e,\n globalY: this._target.globalTransMatrix.f,\n attribute: this._target.attribute,\n theme: getTheme(this._target)[this._target.type],\n target: this._target\n };\n\n if (this._customGrapicKeys) {\n this._customGrapicKeys.forEach(key => {\n info.customKeys[key] = this._target[key];\n });\n } else {\n delete info.customKeys;\n }\n\n const formatter = new JSONFormatter(info, 2);\n this._infoContainer.appendChild(formatter.render());\n }\n\n clearInfo() {\n this._infoContainer.style.display = 'none';\n }\n\n updateMode() {\n this._modeTip.innerText = this._mode;\n }\n\n bindKeyEvent() {\n this._callback.keydown = (e: KeyboardEvent) => {\n if (e.key === 'D') {\n console.log(this._target);\n } else if (e.key === 'S') {\n switch (this._mode) {\n case 'click':\n this._mode = 'hover';\n break;\n case 'hover':\n this._mode = 'click';\n break;\n }\n this.updateMode();\n }\n };\n window.addEventListener('keydown', this._callback.keydown);\n }\n\n release() {\n // 移除信息框\n document.body.removeChild(this._infoContainer);\n\n // 移除高亮框\n this._highlightRect.parentElement.removeChild(this._highlightRect);\n\n // 解绑stage事件\n // this._stage.defaultLayer.removeChild(this._rect);\n this._stage.removeEventListener('pointermove', this._callback.pointermove);\n this._stage.removeEventListener('pointerup', this._callback.pointerup);\n this._stage.removeEventListener('pointerleave', this._callback.pointerleave);\n\n // 解绑键盘事件\n window.removeEventListener('keydown', this._callback.keydown);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/debug-tool/debug-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAW9C,MAAM,OAAO,SAAS;IAgBpB,YAAY,KAAa,EAAE,OAA0B;QAVrD,UAAK,GAAsB,OAAO,CAAC;QAWjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,EAAS,CAAC;QAE3B,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,EAAE;YAC7B,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;SACnD;QAGD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE;YACtB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;SACzC;aAAM;YACL,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;SACnC;QAGD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAG3B,IAAI,CAAC,cAAc,EAAE,CAAC;QAGtB,IAAI,CAAC,YAAY,EAAE,CAAC;IAC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C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAG/C,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAInE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAG7E,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;CACF","file":"debug-tool.js","sourcesContent":["import type { FederatedPointerEvent, IStage, IRect, IGraphic } from './../../vrender';\nimport { createRect, getTheme } from './../../vrender';\nimport JSONFormatter from 'json-formatter-js';\n\nexport interface DebugToolOptions {\n container?: HTMLElement;\n infoPosition?: 'tl' | 'tr' | 'bl' | 'br';\n infoWidth?: number;\n infoHeight?: number;\n mode?: 'hover' | 'click';\n customGrapicKeys?: string[];\n}\n\nexport class DebugTool {\n _stage: IStage;\n _infoContainer: HTMLElement;\n _highlightRect: HTMLElement;\n _target: IGraphic;\n // _rect: IRect;\n _mode: 'hover' | 'click' = 'hover';\n _customGrapicKeys?: string[];\n _modeTip: HTMLElement;\n _callback: {\n pointermove: (e: FederatedPointerEvent) => void;\n pointerup: (e: FederatedPointerEvent) => void;\n pointerleave: (e: FederatedPointerEvent) => void;\n keydown: (e: KeyboardEvent) => void;\n };\n\n constructor(stage: IStage, options?: DebugToolOptions) {\n this._stage = stage;\n this._callback = {} as any;\n\n if (options?.customGrapicKeys) {\n this._customGrapicKeys = options.customGrapicKeys;\n }\n\n // 创建信息框\n if (options?.container) {\n this._infoContainer = options.container;\n } else {\n this.createInfoContainer(options);\n }\n\n // 创建高亮矩形\n this.createHighlightRect();\n\n // 绑定stage事件\n this.bindStageEvent();\n\n // 绑定键盘事件\n this.bindKeyEvent();\n }\n\n createInfoContainer(options?: DebugToolOptions) {\n const position = options?.infoPosition || 'tr';\n const width = options?.infoWidth || 300;\n const height = options?.infoPosition || 400;\n this._infoContainer = document.createElement('div');\n this._infoContainer.style.position = 'fixed';\n this._infoContainer.style.width = `${width}px`;\n this._infoContainer.style.height = `${height}px`;\n this._infoContainer.style.backgroundColor = 'rgba(210, 210, 210, 0.3)';\n this._infoContainer.style.overflow = 'auto';\n this._infoContainer.style.display = 'none';\n switch (position) {\n case 'tl':\n this._infoContainer.style.top = '0px';\n this._infoContainer.style.left = '0px';\n break;\n case 'tr':\n this._infoContainer.style.top = '0px';\n this._infoContainer.style.right = `0px`;\n break;\n case 'bl':\n this._infoContainer.style.bottom = `0px`;\n this._infoContainer.style.left = '0px';\n break;\n case 'br':\n this._infoContainer.style.bottom = `0px`;\n this._infoContainer.style.right = `0px`;\n break;\n }\n\n // Tip\n // debug 模式:hover(shift + s改变模式;shift + d控制台输出target graphic)\n const tip = document.createElement('div');\n const tipSpan1 = document.createElement('span');\n tipSpan1.innerText = 'debug 模式:';\n tip.appendChild(tipSpan1);\n this._modeTip = document.createElement('span');\n this._modeTip.innerText = this._mode;\n tip.appendChild(this._modeTip);\n const tipSpan2 = document.createElement('span');\n tipSpan2.innerText = '(shift + s改变模式;shift + d控制台输出target graphic)';\n tip.appendChild(tipSpan2);\n this._infoContainer.appendChild(tip);\n\n // document.body.append(this._infoContainer);\n this._stage.window.getContainer().append(this._infoContainer);\n }\n\n createHighlightRect() {\n const container = this._stage.window.getContainer();\n this._highlightRect = document.createElement('div');\n this._highlightRect.style.display = 'absolute';\n this._highlightRect.style.border = '1px solid red';\n this._highlightRect.style.pointerEvents = 'none';\n this._highlightRect.style.position = 'absolute';\n container.appendChild(this._highlightRect);\n }\n\n bindStageEvent() {\n this._callback.pointermove = (e: FederatedPointerEvent) => {\n if (this._mode !== 'hover') {\n // do nothing\n } else if (e.target && (e.target as unknown as IGraphic) !== this._target) {\n // 更新bounds\n this._target = e.target as unknown as IGraphic;\n this.addHighlightBounds(this._target.globalAABBBounds);\n setTimeout(() => {\n this.updateInfo();\n }, 100);\n } else if (!e.target) {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointermove', this._callback.pointermove);\n\n this._callback.pointerup = (e: FederatedPointerEvent) => {\n if (this._mode !== 'click') {\n // do nothing\n } else if (e.target && (e.target as unknown as IGraphic) !== this._target) {\n // 更新bounds\n this._target = e.target as unknown as IGraphic;\n this.addHighlightBounds(this._target.globalAABBBounds);\n setTimeout(() => {\n this.updateInfo();\n }, 100);\n } else if (!e.target) {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointerup', this._callback.pointerup);\n\n this._callback.pointerleave = (e: FederatedPointerEvent) => {\n if (this._mode === 'hover') {\n this._target = undefined;\n // this.removeHighlightBounds();\n this.clearInfo();\n }\n };\n this._stage.addEventListener('pointerleave', this._callback.pointerleave);\n }\n\n addHighlightBounds(bounds: any) {\n // 使用VRender绘制高亮框会导致触发多余渲染,因此使用dom\n // this._rect.setAttributes({\n // x: bounds.x1,\n // y: bounds.y1,\n // width: bounds.width(),\n // height: bounds.height(),\n // visible: true,\n // });\n\n // // 保证rect在最上层\n // this._stage.defaultLayer.appendChild(this._rect);\n // this._stage.renderNextFrame();\n\n const table = (this._stage as any).table;\n const stage = table.scenegraph.stage;\n const stageMatrix = stage.window.getViewBoxTransform();\n\n this._highlightRect.style.left = `${bounds.x1 + (stageMatrix.e ?? 0) + (table.options.viewBox?.x1 ?? 0)}px`;\n this._highlightRect.style.top = `${bounds.y1 + (stageMatrix.f ?? 0) + (table.options.viewBox?.y1 ?? 0)}px`;\n this._highlightRect.style.width = `${bounds.width()}px`;\n this._highlightRect.style.height = `${bounds.height()}px`;\n\n // console.log(this._highlightRect.style.left);\n }\n\n // removeHighlightBounds() {\n // this._rect.setAttribute('visible', false);\n // this._stage.renderNextFrame();\n // }\n\n updateInfo() {\n if (!this._target) {\n return;\n }\n // this._infoContainer.innerHTML = '';\n if (this._infoContainer.children.length > 1) {\n this._infoContainer.removeChild(this._infoContainer.children[1]);\n }\n this._infoContainer.style.display = 'block';\n\n const info = {\n customKeys: {},\n type: this._target.type,\n // role: (this._target as any).role,\n globalX: this._target.globalTransMatrix.e,\n globalY: this._target.globalTransMatrix.f,\n attribute: this._target.attribute,\n theme: getTheme(this._target)[this._target.type],\n target: this._target\n };\n\n if (this._customGrapicKeys) {\n this._customGrapicKeys.forEach(key => {\n info.customKeys[key] = this._target[key];\n });\n } else {\n delete info.customKeys;\n }\n\n const formatter = new JSONFormatter(info, 2);\n this._infoContainer.appendChild(formatter.render());\n }\n\n clearInfo() {\n this._infoContainer.style.display = 'none';\n }\n\n updateMode() {\n this._modeTip.innerText = this._mode;\n }\n\n bindKeyEvent() {\n this._callback.keydown = (e: KeyboardEvent) => {\n if (e.key === 'D') {\n console.log(this._target);\n } else if (e.key === 'S') {\n switch (this._mode) {\n case 'click':\n this._mode = 'hover';\n break;\n case 'hover':\n this._mode = 'click';\n break;\n }\n this.updateMode();\n }\n };\n window.addEventListener('keydown', this._callback.keydown);\n }\n\n release() {\n // 移除信息框\n document.body.removeChild(this._infoContainer);\n\n // 移除高亮框\n this._highlightRect.parentElement.removeChild(this._highlightRect);\n\n // 解绑stage事件\n // this._stage.defaultLayer.removeChild(this._rect);\n this._stage.removeEventListener('pointermove', this._callback.pointermove);\n this._stage.removeEventListener('pointerup', this._callback.pointerup);\n this._stage.removeEventListener('pointerleave', this._callback.pointerleave);\n\n // 解绑键盘事件\n window.removeEventListener('keydown', this._callback.keydown);\n }\n}\n"]}
|
|
@@ -55,7 +55,7 @@ export class Chart extends Group {
|
|
|
55
55
|
ctx.inuse = !0, ctx.clearMatrix(), ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, !0),
|
|
56
56
|
ctx.translate(viewBox.x1, viewBox.y1), ctx.setTransformForCurrent(!0), ctx.beginPath(),
|
|
57
57
|
ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1),
|
|
58
|
-
ctx.clip(), ctx.clearMatrix(), chartStage.needRender
|
|
58
|
+
ctx.clip(), ctx.clearMatrix(), table.options.canvas && !chartStage.needRender && (chartStage.pauseRender(),
|
|
59
59
|
table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds), table.scenegraph.updateNextFrame());
|
|
60
60
|
},
|
|
61
61
|
afterRender(stage) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/graphic/chart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAyBjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEjD,MAAM,OAAO,KAAM,SAAQ,KAAK;IAQ9B,YAAY,gBAAyB,EAAE,MAA8B;QACnE,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAgB,OAAc,CAAC;QASjC,IAAI,CAAC,UAAU,GAAG,iBAAiB,CAAC;QACpC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QAEzC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,MAAM,CAAC,SAAS,CAC9D,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;gBACzC,YAAY,EAAE,MAAM,CAAC,MAAM;gBAC3B,IA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C,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAE/D,OAAO,SAAS,CAAC;AACnB,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute, Stage } from './../../vrender';\nimport { genNumberType, Group } from './../../vrender';\nimport { Bounds, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string | Record<string, string>; //如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> <dataId, series-chart的指标key用于过滤数据>\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n mode: string;\n modeParams: any;\n dpr: number;\n // viewBox: {\n // x1: number;\n // y1: number;\n // x2: number;\n // y2: number;\n // };\n tableChartOption: any;\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement | { x: number; y: number; width: number; height: number; canvas: HTMLCanvasElement }[]; // HTMLCanvasElement\n isShareChartSpec: boolean; //针对chartSpec用户配置成函数形式的话 就不需要存储chartInstance了 会太占内存,使用这个变量 当渲染出缓存图表会就删除chartInstance实例\n constructor(isShareChartSpec: boolean, params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n this.isShareChartSpec = isShareChartSpec;\n // 创建chart\n if (!params.chartInstance) {\n const chartInstance = (this.chartInstance = new params.ClassType(\n params.spec,\n merge({}, this.attribute.tableChartOption, {\n renderCanvas: params.canvas,\n mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',\n modeParams: this.attribute.modeParams,\n canvasControled: false,\n viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },\n dpr: params.dpr,\n // viewBox: params.viewBox,\n // viewBox: this.getViewBox(),\n // viewBox: {\n // x1: params.cellPadding[3],\n // x2: params.width - params.cellPadding[1],\n // y1: params.cellPadding[0],\n // y2: params.height - params.cellPadding[2]\n // },\n interactive: false,\n animation: false,\n autoFit: false\n })\n ));\n chartInstance.renderSync();\n chartInstance.getStage().enableDirtyBounds();\n params.chartInstance = this.chartInstance = chartInstance;\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n\n // onBeforeAttributeUpdate() {\n // if (arguments[2] === y) {\n // debugger;\n // }\n // }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n const { col, row } = this.parent;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n // const { x1, y1, x2, y2 } = this.attribute.viewBox;\n const { x1, y1, x2, y2 } = this.getViewBox();\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = getTableBounds(col, row, table);\n const clipBound = tableBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(\n this.attribute.spec,\n merge({}, this.attribute.tableChartOption, {\n // disableDirtyBounds: true,\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n // viewBox: {\n // x1: x1 - table.scrollLeft,\n // x2: x2 - table.scrollLeft,\n // y1: y1 - table.scrollTop,\n // y2: y2 - table.scrollTop\n // },\n viewBox: {\n x1: 0,\n x2: x2 - x1,\n y1: 0,\n y2: y2 - y1\n },\n dpr: table.internalProps.pixelRatio,\n animation: false,\n interactive: true,\n autoFit: false, //控制当容器变化大小时vchart实例不应响应事件进行内部处理\n beforeRender: (chartStage: Stage) => {\n const stage = this.stage;\n const ctx = chartStage.window.getContext();\n const stageMatrix = stage.window.getViewBoxTransform();\n const viewBox = stage.window.getViewBox();\n ctx.inuse = true;\n // ctx.save();\n // console.log(ctx.getImageData(0, 0, 100, 100));\n ctx.clearMatrix();\n ctx.setTransform(\n stageMatrix.a,\n stageMatrix.b,\n stageMatrix.c,\n stageMatrix.d,\n stageMatrix.e,\n stageMatrix.f,\n true\n );\n ctx.translate(viewBox.x1, viewBox.y1);\n ctx.setTransformForCurrent(true);\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n ctx.clearMatrix();\n\n if (!(chartStage as any).needRender) {\n chartStage.pauseRender();\n table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);\n table.scenegraph.updateNextFrame();\n }\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n\n stage.needRender = false;\n chartStage.resumeRender();\n }\n })\n );\n const chartStage = this.activeChartInstance.getStage();\n // chartStage.needRender = true;\n // chartStage.background = 'red';\n const matrix = this.globalTransMatrix.clone();\n const stageMatrix = this.stage.window.getViewBoxTransform();\n matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);\n chartStage.window.setViewBoxTransform &&\n chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);\n\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n // move active chart view box out of browser view\n // to avoid async render when chart is releasd\n this.activeChartInstance?.updateViewBox(\n {\n x1: -1000,\n x2: -800,\n y1: -1000,\n y2: -800\n },\n false,\n false\n );\n this.activeChartInstance?.release();\n this.activeChartInstance = null;\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n\n getViewBox(): {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n } {\n const cellGroup = this.parent as Group;\n const padding = this.attribute.cellPadding;\n const table = (this.stage as any).table as BaseTableAPI;\n\n const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;\n\n return {\n x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),\n x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),\n y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),\n y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))\n };\n }\n}\n\nfunction getTableBounds(col: number, row: number, table: BaseTableAPI) {\n const { layoutMap } = table.internalProps;\n const bodyBound = new Bounds();\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n bodyBound.x1 = tableBound.x1;\n bodyBound.x2 = tableBound.x2;\n bodyBound.y1 = tableBound.y1;\n bodyBound.y2 = tableBound.y2;\n\n if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {\n // no frozen body\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) {\n // frozen cornor\n } else if (layoutMap.isFrozenColumn(col, row)) {\n // left frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isRightFrozenColumn(col, row)) {\n // right frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isBottomFrozenRow(col, row)) {\n // bottom frozen\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n }\n\n bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);\n bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);\n bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);\n bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);\n\n return bodyBound;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/graphic/chart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAyBjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEjD,MAAM,OAAO,KAAM,SAAQ,KAAK;IAQ9B,YAAY,gBAAyB,EAAE,MAA8B;QACnE,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAgB,OAAc,CAAC;QASjC,IAAI,CAAC,UAAU,GAAG,iBAAiB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AAC,uBAAuB,EAAE,CAAC;KAChE;IAED,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,OAAO,0CAAE,EAAE,mCAAI,CAAC,CAAC,CAAC;IAE/D,OAAO,SAAS,CAAC;AACnB,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute, Stage } from './../../vrender';\nimport { genNumberType, Group } from './../../vrender';\nimport { Bounds, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string | Record<string, string>; //如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> <dataId, series-chart的指标key用于过滤数据>\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n mode: string;\n modeParams: any;\n dpr: number;\n // viewBox: {\n // x1: number;\n // y1: number;\n // x2: number;\n // y2: number;\n // };\n tableChartOption: any;\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement | { x: number; y: number; width: number; height: number; canvas: HTMLCanvasElement }[]; // HTMLCanvasElement\n isShareChartSpec: boolean; //针对chartSpec用户配置成函数形式的话 就不需要存储chartInstance了 会太占内存,使用这个变量 当渲染出缓存图表会就删除chartInstance实例\n constructor(isShareChartSpec: boolean, params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n this.isShareChartSpec = isShareChartSpec;\n // 创建chart\n if (!params.chartInstance) {\n const chartInstance = (this.chartInstance = new params.ClassType(\n params.spec,\n merge({}, this.attribute.tableChartOption, {\n renderCanvas: params.canvas,\n mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',\n modeParams: this.attribute.modeParams,\n canvasControled: false,\n viewBox: { x1: 0, x2: 0, y1: 0, y2: 0 },\n dpr: params.dpr,\n // viewBox: params.viewBox,\n // viewBox: this.getViewBox(),\n // viewBox: {\n // x1: params.cellPadding[3],\n // x2: params.width - params.cellPadding[1],\n // y1: params.cellPadding[0],\n // y2: params.height - params.cellPadding[2]\n // },\n interactive: false,\n animation: false,\n autoFit: false\n })\n ));\n chartInstance.renderSync();\n chartInstance.getStage().enableDirtyBounds();\n params.chartInstance = this.chartInstance = chartInstance;\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n\n // onBeforeAttributeUpdate() {\n // if (arguments[2] === y) {\n // debugger;\n // }\n // }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n const { col, row } = this.parent;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n // const { x1, y1, x2, y2 } = this.attribute.viewBox;\n const { x1, y1, x2, y2 } = this.getViewBox();\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = getTableBounds(col, row, table);\n const clipBound = tableBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(\n this.attribute.spec,\n merge({}, this.attribute.tableChartOption, {\n // disableDirtyBounds: true,\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n // viewBox: {\n // x1: x1 - table.scrollLeft,\n // x2: x2 - table.scrollLeft,\n // y1: y1 - table.scrollTop,\n // y2: y2 - table.scrollTop\n // },\n viewBox: {\n x1: 0,\n x2: x2 - x1,\n y1: 0,\n y2: y2 - y1\n },\n dpr: table.internalProps.pixelRatio,\n animation: false,\n interactive: true,\n autoFit: false, //控制当容器变化大小时vchart实例不应响应事件进行内部处理\n beforeRender: (chartStage: Stage) => {\n const stage = this.stage;\n const ctx = chartStage.window.getContext();\n const stageMatrix = stage.window.getViewBoxTransform();\n const viewBox = stage.window.getViewBox();\n ctx.inuse = true;\n // ctx.save();\n // console.log(ctx.getImageData(0, 0, 100, 100));\n ctx.clearMatrix();\n ctx.setTransform(\n stageMatrix.a,\n stageMatrix.b,\n stageMatrix.c,\n stageMatrix.d,\n stageMatrix.e,\n stageMatrix.f,\n true\n );\n ctx.translate(viewBox.x1, viewBox.y1);\n ctx.setTransformForCurrent(true); // 替代原有的chart viewBox\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n ctx.clearMatrix();\n\n if (table.options.canvas && !(chartStage as any).needRender) {\n // 在使用viewbox局部渲染时,activate单独渲染chart stage,可能导致外部stage场景层级错乱\n // 此时触发整个表格的重绘,外部stage场景可以通过table的beforeRender配置触发更上一级的重绘\n chartStage.pauseRender();\n table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);\n table.scenegraph.updateNextFrame();\n }\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n\n stage.needRender = false;\n chartStage.resumeRender();\n }\n })\n );\n const chartStage = this.activeChartInstance.getStage();\n // chartStage.needRender = true;\n // chartStage.background = 'red';\n const matrix = this.globalTransMatrix.clone();\n const stageMatrix = this.stage.window.getViewBoxTransform();\n matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);\n chartStage.window.setViewBoxTransform &&\n chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);\n\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n // move active chart view box out of browser view\n // to avoid async render when chart is releasd\n this.activeChartInstance?.updateViewBox(\n {\n x1: -1000,\n x2: -800,\n y1: -1000,\n y2: -800\n },\n false,\n false\n );\n this.activeChartInstance?.release();\n this.activeChartInstance = null;\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n\n getViewBox(): {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n } {\n const cellGroup = this.parent as Group;\n const padding = this.attribute.cellPadding;\n const table = (this.stage as any).table as BaseTableAPI;\n\n const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;\n\n return {\n x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),\n x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),\n y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),\n y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))\n };\n }\n}\n\nfunction getTableBounds(col: number, row: number, table: BaseTableAPI) {\n const { layoutMap } = table.internalProps;\n const bodyBound = new Bounds();\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n bodyBound.x1 = tableBound.x1;\n bodyBound.x2 = tableBound.x2;\n bodyBound.y1 = tableBound.y1;\n bodyBound.y2 = tableBound.y2;\n\n if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {\n // no frozen body\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) {\n // frozen cornor\n } else if (layoutMap.isFrozenColumn(col, row)) {\n // left frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isRightFrozenColumn(col, row)) {\n // right frozen\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n } else if (layoutMap.isBottomFrozenRow(col, row)) {\n // bottom frozen\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n }\n\n bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);\n bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);\n bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);\n bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);\n\n return bodyBound;\n}\n"]}
|
|
@@ -7,40 +7,77 @@ import { getQuadProps } from "../utils/padding";
|
|
|
7
7
|
import { getProp } from "../utils/get-prop";
|
|
8
8
|
|
|
9
9
|
export function updateChartSizeForResizeColWidth(scenegraph, col) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const columnGroup = scenegraph.getColGroup(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const {table: table} = scenegraph, layout = table.internalProps.layoutMap, columnResizeType = -1 === col ? "all" : table.internalProps.columnResizeType;
|
|
11
|
+
if ("column" === columnResizeType) {
|
|
12
|
+
const columnGroup = scenegraph.getColGroup(col);
|
|
13
|
+
if (null == columnGroup || columnGroup.forEachChildren((cellNode => {
|
|
14
|
+
updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row));
|
|
15
|
+
})), "adaptive" === table.widthMode && col < table.colCount - 1) {
|
|
16
|
+
const columnGroup = scenegraph.getColGroup(col + 1);
|
|
17
|
+
null == columnGroup || columnGroup.forEachChildren((cellNode => {
|
|
18
|
+
updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row));
|
|
18
19
|
}));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
let resizeIndicatorKey, resizeDimensionKey, resizeDimensionValue, startCol = table.rowHeaderLevelCount, endCol = table.colCount - 1;
|
|
23
|
+
if ("indicator" === columnResizeType) if (layout.indicatorsAsCol) resizeIndicatorKey = layout.getIndicatorKey(col, table.columnHeaderLevelCount); else {
|
|
24
|
+
const headerPaths = layout.getCellHeaderPaths(col, table.columnHeaderLevelCount - 1), headerPath = headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
|
|
25
|
+
resizeDimensionKey = headerPath.dimensionKey, resizeDimensionValue = headerPath.value;
|
|
26
|
+
} else if ("indicatorGroup" === columnResizeType) {
|
|
27
|
+
const layout = table.internalProps.layoutMap, headerPaths = layout.getCellHeaderPaths(table.stateManager.columnResize.col, table.columnHeaderLevelCount), node = layout.getHeadNodeByRowOrColDimensions(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1));
|
|
28
|
+
startCol = node.startInTotal + table.frozenColCount, endCol = node.startInTotal + table.frozenColCount + node.size - 1;
|
|
29
|
+
}
|
|
30
|
+
for (let c = startCol; c <= endCol; c++) {
|
|
31
|
+
const columnGroup = scenegraph.getColGroup(c);
|
|
32
|
+
if (columnGroup) {
|
|
33
|
+
if ("indicator" === columnResizeType) {
|
|
34
|
+
const indicatorKey = layout.getIndicatorKey(c, table.columnHeaderLevelCount);
|
|
35
|
+
if (layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) continue;
|
|
36
|
+
if (!layout.indicatorsAsCol) {
|
|
37
|
+
const headerPaths = layout.getCellHeaderPaths(c, table.columnHeaderLevelCount - 1), headerPath = null == headerPaths ? void 0 : headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
|
|
38
|
+
if (!headerPath || resizeDimensionKey !== headerPath.dimensionKey || resizeDimensionValue !== headerPath.value) continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
columnGroup.forEachChildren((cellNode => {
|
|
42
|
+
updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row));
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
30
46
|
}
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
export function updateChartSizeForResizeRowHeight(scenegraph, row) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
var _a;
|
|
51
|
+
const {table: table} = scenegraph, layout = table.internalProps.layoutMap, state = table.stateManager, rowResizeType = -1 === row ? "all" : table.internalProps.rowResizeType;
|
|
52
|
+
let resizeIndicatorKey, resizeDimensionKey, resizeDimensionValue, startRow = table.columnHeaderLevelCount, endRow = table.rowCount - 1;
|
|
53
|
+
if ("indicator" === rowResizeType) if (layout.indicatorsAsCol) {
|
|
54
|
+
const headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount - 1, row), headerPath = null === (_a = headerPaths.rowHeaderPaths) || void 0 === _a ? void 0 : _a[headerPaths.rowHeaderPaths.length - 1];
|
|
55
|
+
resizeDimensionKey = null == headerPath ? void 0 : headerPath.dimensionKey, resizeDimensionValue = null == headerPath ? void 0 : headerPath.value;
|
|
56
|
+
} else resizeIndicatorKey = layout.getIndicatorKey(table.rowHeaderLevelCount, row); else if ("indicatorGroup" === rowResizeType) {
|
|
57
|
+
const layout = table.internalProps.layoutMap, headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount, row), node = layout.getHeadNodeByRowOrColDimensions(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length - 1));
|
|
58
|
+
startRow = node.startInTotal + table.frozenRowCount, endRow = node.startInTotal + table.frozenRowCount + node.size - 1;
|
|
59
|
+
}
|
|
60
|
+
for (let col = scenegraph.proxy.colStart; col <= scenegraph.proxy.colEnd; col++) if ("row" === rowResizeType) {
|
|
61
|
+
const cellNode = scenegraph.highPerformanceGetCell(col, row);
|
|
62
|
+
if ("cell" !== cellNode.role) continue;
|
|
63
|
+
if (updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row)),
|
|
64
|
+
"adaptive" === table.heightMode && row < table.rowCount - 1) {
|
|
65
|
+
const cellNode = scenegraph.highPerformanceGetCell(col, row + 1);
|
|
66
|
+
updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row));
|
|
67
|
+
}
|
|
68
|
+
} else for (let r = startRow; r <= endRow; r++) {
|
|
69
|
+
if ("indicator" === rowResizeType) {
|
|
70
|
+
const indicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, r);
|
|
71
|
+
if (!layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) continue;
|
|
72
|
+
if (layout.indicatorsAsCol) {
|
|
73
|
+
const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, r), headerPath = null == headerPaths ? void 0 : headerPaths.rowHeaderPaths[headerPaths.rowHeaderPaths.length - 1];
|
|
74
|
+
if (!headerPath || resizeDimensionKey !== headerPath.dimensionKey || resizeDimensionValue !== headerPath.value) continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const cellNode = scenegraph.highPerformanceGetCell(col, r);
|
|
78
|
+
if ("cell" !== cellNode.role) continue;
|
|
79
|
+
updateChartGraphicSize(cellNode, table.getColWidth(cellNode.col), table.getRowHeight(cellNode.row));
|
|
80
|
+
}
|
|
44
81
|
}
|
|
45
82
|
|
|
46
83
|
export function clearChartCacheImage(scenegraph) {
|
|
@@ -120,4 +157,13 @@ function updateTableAxes(containerGroup, table) {
|
|
|
120
157
|
}));
|
|
121
158
|
}));
|
|
122
159
|
}
|
|
160
|
+
|
|
161
|
+
function updateChartGraphicSize(cellNode, width, height) {
|
|
162
|
+
cellNode.forEachChildren((graphic => {
|
|
163
|
+
"chart" === graphic.type && (graphic.cacheCanvas = null, graphic.setAttributes({
|
|
164
|
+
width: Math.ceil(width - graphic.attribute.cellPadding[3] - graphic.attribute.cellPadding[1]),
|
|
165
|
+
height: Math.ceil(height - graphic.attribute.cellPadding[0] - graphic.attribute.cellPadding[2])
|
|
166
|
+
}));
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
123
169
|
//# sourceMappingURL=update-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../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B,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC/F,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC1D,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;wBACvF,MAAM,aAAa,GAAmB,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;wBACnE,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBACxG,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACjC,IAAI,CAAC,OAAO,EAAE,CAAC;qBAChB;iBACF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC","file":"update-chart.js","sourcesContent":["import { isEqual } from '@visactor/vutils';\nimport type { PivotChart } from '../../PivotChart';\nimport type { ICartesianAxis } from '../../components/axis/axis';\nimport { Factory } from '../../core/factory';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from '../graphic/chart';\nimport type { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\n\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSizeForResizeColWidth(scenegraph: Scenegraph, col: number) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = col; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n // const chartInstance = (columnGroup.attribute as any)?.chartInstance;\n // if (chartInstance) {\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const width = scenegraph.table.getColWidth(cellNode.col);\n const height = scenegraph.table.getRowHeight(cellNode.row);\n\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n // 调试问题使用\n // if (columnGroup.col === 2) {\n // columnGroup.AABBBounds.width();\n // node.AABBBounds.width();\n // console.log(\n // 'set viewbox y1',\n // Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // node.globalAABBBounds.height()\n // );\n\n // console.log(\n // 'updateChartSize',\n // columnGroup,\n // columnGroup.globalAABBBounds.y1,\n // cellNode.globalAABBBounds.y1,\n // node.globalAABBBounds.y1\n // );\n // }\n\n node.cacheCanvas = null;\n node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n node.setAttribute(\n 'height',\n Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n );\n\n // node.setAttribute('viewBox', {\n // x1: Math.ceil(cellNode.globalAABBBounds.x1 + node.attribute.cellPadding[3] + scenegraph.table.scrollLeft),\n // x2: Math.ceil(\n // cellNode.globalAABBBounds.x1 + width - node.attribute.cellPadding[1] + scenegraph.table.scrollLeft\n // ),\n // y1: Math.ceil(cellNode.globalAABBBounds.y1 + node.attribute.cellPadding[0] + scenegraph.table.scrollTop),\n // y2: Math.ceil(\n // cellNode.globalAABBBounds.y1 + height - node.attribute.cellPadding[2] + scenegraph.table.scrollTop\n // )\n // });\n }\n });\n });\n // }\n }\n // 右侧冻结的单元格也需要调整\n if (!scenegraph.table.isPivotChart() && scenegraph.table.rightFrozenColCount >= 1) {\n for (\n let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount;\n c <= scenegraph.table.colCount - 1;\n c++\n ) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const width = scenegraph.table.getColWidth(cellNode.col);\n const height = scenegraph.table.getRowHeight(cellNode.row);\n\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.setAttribute(\n 'width',\n Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1])\n );\n node.setAttribute(\n 'height',\n Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n );\n }\n });\n });\n }\n }\n}\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSizeForResizeRowHeight(scenegraph: Scenegraph, row: number) {\n const updateCellNode = (c: number, r: number) => {\n const cellNode = scenegraph.getCell(c, r);\n const width = scenegraph.table.getColWidth(cellNode.col);\n const height = scenegraph.table.getRowHeight(cellNode.row);\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n console.log('bf', c, r, node.attribute.width, node.attribute.height);\n\n node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n node.setAttribute('height', Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2]));\n console.log('af', c, r, node.attribute.width, node.attribute.height);\n }\n });\n };\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n updateCellNode(c, r);\n }\n }\n\n // 右侧冻结的单元格也需要调整\n if (scenegraph.table.rightFrozenColCount >= 1) {\n for (\n let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount;\n c <= scenegraph.table.colCount - 1;\n c++\n ) {\n for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n updateCellNode(c, r);\n }\n }\n }\n // 左侧冻结的单元格\n if (scenegraph.table.frozenColCount >= 1) {\n for (let c = 0; c <= scenegraph.table.frozenColCount - 1; c++) {\n for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n updateCellNode(c, r);\n }\n }\n }\n}\n/** 清理所有chart节点的 图表缓存图片 */\nexport function clearChartCacheImage(scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n });\n }\n}\n\nexport function clearCellChartCacheImage(col: number, row: number, scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n const cellGroup = scenegraph.getCell(col, row);\n cellGroup.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n}\n\n/** 更新所有的图表chart节点上缓存attribute中的data数据 */\nexport function updateChartData(scenegraph: Scenegraph) {\n const table = scenegraph.table;\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const col = cellNode.col;\n const row = cellNode.row;\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.updateData(table.getCellValue(col, row));\n const newAxes = table.internalProps.layoutMap.getChartAxes(col, row);\n node.setAttribute('axes', newAxes);\n const chartSpec = node.attribute.spec;\n chartSpec.axes = newAxes;\n node.setAttribute('spec', chartSpec);\n // node.addUpdateBoundTag();\n }\n });\n });\n }\n\n // update left axes\n updateTableAxes(scenegraph.rowHeaderGroup, scenegraph.table);\n // update top axes\n updateTableAxes(scenegraph.colHeaderGroup, scenegraph.table);\n // update right axes\n updateTableAxes(scenegraph.rightFrozenGroup, scenegraph.table);\n // update bottom axes\n updateTableAxes(scenegraph.bottomFrozenGroup, scenegraph.table);\n}\n/** 组织图表数据状态_selectedDataItemsInChart 更新选中的图表图元状态 */\nexport function updateChartState(scenegraph: Scenegraph, datum: any) {\n const table = scenegraph.table;\n if (table.isPivotChart()) {\n const preSelectItemsCount = (table as PivotChart)._selectedDataItemsInChart.length;\n if ((datum === null || datum?.length === 0 || Object.keys(datum).length === 0) && preSelectItemsCount === 0) {\n //避免无效的更新\n return;\n }\n // (table as PivotChart)._selectedDataItemsInChart = [];\n const newSelectedDataItemsInChart = [];\n if (Array.isArray(datum)) {\n datum.forEach((dataItem: any) => {\n if (dataItem && dataItem.key !== 0 && Object.keys(dataItem).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in dataItem) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = dataItem[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n });\n } else if (datum && datum.key !== 0 && Object.keys(datum).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {};\n for (const itemKey in datum) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = datum[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n //避免无效的更新\n if (!isEqual((table as PivotChart)._selectedDataItemsInChart, newSelectedDataItemsInChart)) {\n (table as PivotChart)._selectedDataItemsInChart = newSelectedDataItemsInChart;\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).updateDataStateToChartInstance();\n // 清楚chart缓存图片\n clearChartCacheImage(scenegraph);\n table.scenegraph.updateNextFrame();\n }\n }\n}\n\n/**\n * @description: update table axis component\n * @param {Group} containerGroup\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction updateTableAxes(containerGroup: Group, table: BaseTableAPI) {\n containerGroup.forEachChildren((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildren((cell: Group) => {\n if (cell.role === 'cell') {\n let isAxisComponent = false;\n cell.forEachChildren((mark: Group) => {\n if (mark.name === 'axis') {\n isAxisComponent = true;\n return true;\n }\n return false;\n });\n if (isAxisComponent) {\n const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row);\n const cellStyle = table._getCellStyle(cell.col, cell.row);\n const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table));\n const CartesianAxis: ICartesianAxis = Factory.getComponent('axis');\n const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table);\n cell.clear();\n cell.appendChild(axis.component);\n axis.overlap();\n }\n }\n });\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/refresh-node/update-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,UAAU,gCAAgC,CAAC,UAAsB,EAAE,GAAW;IAClF,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,SAAiC,CAAC;IACrE,MAAM,gBAAgB,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAEnF,IAAI,gBAAgB,KAAK,QAA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Aa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;wBACxG,IAAI,CAAC,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACjC,IAAI,CAAC,OAAO,EAAE,CAAC;qBAChB;iBACF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAe,EAAE,KAAa,EAAE,MAAc;IAC5E,QAAQ,CAAC,eAAe,CAAC,CAAC,OAAc,EAAE,EAAE;QAC1C,IAAK,OAAe,CAAC,IAAI,KAAK,OAAO,EAAE;YACrC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,OAAO,CAAC,aAAa,CAAC;gBACpB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC7F,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;aAChG,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC","file":"update-chart.js","sourcesContent":["import { isEqual } from '@visactor/vutils';\nimport type { PivotChart } from '../../PivotChart';\nimport type { ICartesianAxis } from '../../components/axis/axis';\nimport { Factory } from '../../core/factory';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Chart } from '../graphic/chart';\nimport type { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\n\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSizeForResizeColWidth(scenegraph: Scenegraph, col: number) {\n const { table } = scenegraph;\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n const columnResizeType = col === -1 ? 'all' : table.internalProps.columnResizeType;\n\n if (columnResizeType === 'column') {\n const columnGroup = scenegraph.getColGroup(col);\n columnGroup?.forEachChildren((cellNode: Group) => {\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n });\n if (table.widthMode === 'adaptive' && col < table.colCount - 1) {\n const columnGroup = scenegraph.getColGroup(col + 1);\n columnGroup?.forEachChildren((cellNode: Group) => {\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n });\n }\n } else {\n let startCol = table.rowHeaderLevelCount;\n let endCol = table.colCount - 1;\n let resizeIndicatorKey;\n let resizeDimensionKey;\n let resizeDimensionValue;\n if (columnResizeType === 'indicator') {\n if (layout.indicatorsAsCol) {\n resizeIndicatorKey = layout.getIndicatorKey(col, table.columnHeaderLevelCount);\n } else {\n const headerPaths = layout.getCellHeaderPaths(col, table.columnHeaderLevelCount - 1);\n const headerPath = headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];\n resizeDimensionKey = headerPath.dimensionKey;\n resizeDimensionValue = headerPath.value;\n }\n } else if (columnResizeType === 'indicatorGroup') {\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n //通过getCellHeaderPaths接口获取列表头最后一层指标维度的path\n const headerPaths = layout.getCellHeaderPaths(table.stateManager.columnResize.col, table.columnHeaderLevelCount);\n const node = layout.getHeadNodeByRowOrColDimensions(\n headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1)\n ) as any;\n // 计算宽度受影响列的起止\n startCol = node.startInTotal + table.frozenColCount;\n endCol = node.startInTotal + table.frozenColCount + node.size - 1;\n }\n\n for (let c = startCol; c <= endCol; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n if (columnGroup) {\n if (columnResizeType === 'indicator') {\n const indicatorKey = layout.getIndicatorKey(c, table.columnHeaderLevelCount);\n if (layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) {\n continue;\n } else if (!layout.indicatorsAsCol) {\n const headerPaths = layout.getCellHeaderPaths(c, table.columnHeaderLevelCount - 1);\n const headerPath = headerPaths?.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];\n if (\n !headerPath ||\n resizeDimensionKey !== headerPath.dimensionKey ||\n resizeDimensionValue !== headerPath.value\n ) {\n continue;\n }\n }\n }\n columnGroup.forEachChildren((cellNode: Group) => {\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n });\n }\n }\n }\n\n // // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n // for (let c = col; c <= scenegraph.proxy.colEnd; c++) {\n // const columnGroup = scenegraph.getColGroup(c);\n // // const chartInstance = (columnGroup.attribute as any)?.chartInstance;\n // // if (chartInstance) {\n // columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n // const width = scenegraph.table.getColWidth(cellNode.col);\n // const height = scenegraph.table.getRowHeight(cellNode.row);\n\n // cellNode.children.forEach((node: Chart) => {\n // if ((node as any).type === 'chart') {\n // node.cacheCanvas = null;\n // node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n // node.setAttribute(\n // 'height',\n // Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n // );\n // }\n // });\n // });\n // // }\n // }\n // // 右侧冻结的单元格也需要调整\n // if (!scenegraph.table.isPivotChart() && scenegraph.table.rightFrozenColCount >= 1) {\n // for (\n // let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount;\n // c <= scenegraph.table.colCount - 1;\n // c++\n // ) {\n // const columnGroup = scenegraph.getColGroup(c);\n // columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n // const width = scenegraph.table.getColWidth(cellNode.col);\n // const height = scenegraph.table.getRowHeight(cellNode.row);\n\n // cellNode.children.forEach((node: Chart) => {\n // if ((node as any).type === 'chart') {\n // node.cacheCanvas = null;\n // node.setAttribute(\n // 'width',\n // Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1])\n // );\n // node.setAttribute(\n // 'height',\n // Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2])\n // );\n // }\n // });\n // });\n // }\n // }\n}\n/** 供调整列宽后更新chart使用 */\nexport function updateChartSizeForResizeRowHeight(scenegraph: Scenegraph, row: number) {\n const { table } = scenegraph;\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n const state = table.stateManager;\n const rowResizeType = row === -1 ? 'all' : table.internalProps.rowResizeType;\n\n let startRow = table.columnHeaderLevelCount;\n let endRow = table.rowCount - 1;\n let resizeIndicatorKey;\n let resizeDimensionKey;\n let resizeDimensionValue;\n if (rowResizeType === 'indicator') {\n if (!layout.indicatorsAsCol) {\n resizeIndicatorKey = layout.getIndicatorKey(table.rowHeaderLevelCount, row);\n } else {\n const headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount - 1, row);\n const headerPath = headerPaths.rowHeaderPaths?.[headerPaths.rowHeaderPaths.length - 1];\n resizeDimensionKey = headerPath?.dimensionKey;\n resizeDimensionValue = headerPath?.value;\n }\n } else if (rowResizeType === 'indicatorGroup') {\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n //通过getCellHeaderPaths接口获取列表头最后一层指标维度的path\n const headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount, row);\n const node = layout.getHeadNodeByRowOrColDimensions(\n headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length - 1)\n ) as any;\n // 计算宽度受影响列的起止\n startRow = node.startInTotal + table.frozenRowCount;\n endRow = node.startInTotal + table.frozenRowCount + node.size - 1;\n }\n\n for (let col = scenegraph.proxy.colStart; col <= scenegraph.proxy.colEnd; col++) {\n if (rowResizeType === 'row') {\n const cellNode = scenegraph.highPerformanceGetCell(col, row);\n if (cellNode.role !== 'cell') {\n continue;\n }\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n\n if (table.heightMode === 'adaptive' && row < table.rowCount - 1) {\n const cellNode = scenegraph.highPerformanceGetCell(col, row + 1);\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n }\n } else {\n for (let r = startRow; r <= endRow; r++) {\n if (rowResizeType === 'indicator') {\n const indicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, r);\n if (!layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) {\n continue;\n } else if (layout.indicatorsAsCol) {\n const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, r);\n const headerPath = headerPaths?.rowHeaderPaths[headerPaths.rowHeaderPaths.length - 1];\n if (\n !headerPath ||\n resizeDimensionKey !== headerPath.dimensionKey ||\n resizeDimensionValue !== headerPath.value\n ) {\n continue;\n }\n }\n }\n const cellNode = scenegraph.highPerformanceGetCell(col, r);\n if (cellNode.role !== 'cell') {\n continue;\n }\n const width = table.getColWidth(cellNode.col);\n const height = table.getRowHeight(cellNode.row);\n updateChartGraphicSize(cellNode, width, height);\n }\n }\n }\n\n // const updateCellNode = (c: number, r: number) => {\n // const cellNode = scenegraph.getCell(c, r);\n // const width = scenegraph.table.getColWidth(cellNode.col);\n // const height = scenegraph.table.getRowHeight(cellNode.row);\n // cellNode.children.forEach((node: Chart) => {\n // if ((node as any).type === 'chart') {\n // node.cacheCanvas = null;\n // console.log('bf', c, r, node.attribute.width, node.attribute.height);\n\n // node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));\n // node.setAttribute('height', Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2]));\n // console.log('af', c, r, node.attribute.width, node.attribute.height);\n // }\n // });\n // };\n // // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n // for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n // for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n // updateCellNode(c, r);\n // }\n // }\n\n // // 右侧冻结的单元格也需要调整\n // if (scenegraph.table.rightFrozenColCount >= 1) {\n // for (\n // let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount;\n // c <= scenegraph.table.colCount - 1;\n // c++\n // ) {\n // for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n // updateCellNode(c, r);\n // }\n // }\n // }\n // // 左侧冻结的单元格\n // if (scenegraph.table.frozenColCount >= 1) {\n // for (let c = 0; c <= scenegraph.table.frozenColCount - 1; c++) {\n // for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {\n // updateCellNode(c, r);\n // }\n // }\n // }\n}\n/** 清理所有chart节点的 图表缓存图片 */\nexport function clearChartCacheImage(scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n });\n }\n}\n\nexport function clearCellChartCacheImage(col: number, row: number, scenegraph: Scenegraph) {\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n const cellGroup = scenegraph.getCell(col, row);\n cellGroup.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.cacheCanvas = null;\n node.addUpdateBoundTag();\n }\n });\n}\n\n/** 更新所有的图表chart节点上缓存attribute中的data数据 */\nexport function updateChartData(scenegraph: Scenegraph) {\n const table = scenegraph.table;\n // 将调整列宽的后面的面也都一起需要调整viewbox。 TODO:columnResizeType支持后需要根据变化的列去调整,范围可能变多或者变少\n for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {\n const columnGroup = scenegraph.getColGroup(c);\n columnGroup?.getChildren()?.forEach((cellNode: Group) => {\n const col = cellNode.col;\n const row = cellNode.row;\n cellNode.children.forEach((node: Chart) => {\n if ((node as any).type === 'chart') {\n node.updateData(table.getCellValue(col, row));\n const newAxes = table.internalProps.layoutMap.getChartAxes(col, row);\n node.setAttribute('axes', newAxes);\n const chartSpec = node.attribute.spec;\n chartSpec.axes = newAxes;\n node.setAttribute('spec', chartSpec);\n // node.addUpdateBoundTag();\n }\n });\n });\n }\n\n // update left axes\n updateTableAxes(scenegraph.rowHeaderGroup, scenegraph.table);\n // update top axes\n updateTableAxes(scenegraph.colHeaderGroup, scenegraph.table);\n // update right axes\n updateTableAxes(scenegraph.rightFrozenGroup, scenegraph.table);\n // update bottom axes\n updateTableAxes(scenegraph.bottomFrozenGroup, scenegraph.table);\n}\n/** 组织图表数据状态_selectedDataItemsInChart 更新选中的图表图元状态 */\nexport function updateChartState(scenegraph: Scenegraph, datum: any) {\n const table = scenegraph.table;\n if (table.isPivotChart()) {\n const preSelectItemsCount = (table as PivotChart)._selectedDataItemsInChart.length;\n if ((datum === null || datum?.length === 0 || Object.keys(datum).length === 0) && preSelectItemsCount === 0) {\n //避免无效的更新\n return;\n }\n // (table as PivotChart)._selectedDataItemsInChart = [];\n const newSelectedDataItemsInChart = [];\n if (Array.isArray(datum)) {\n datum.forEach((dataItem: any) => {\n if (dataItem && dataItem.key !== 0 && Object.keys(dataItem).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {} as any;\n for (const itemKey in dataItem) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = dataItem[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n });\n } else if (datum && datum.key !== 0 && Object.keys(datum).length > 0) {\n //本以为没有点击到图元上 datum为空 发现是{key:0}或者{}\n const selectedState = {} as any;\n for (const itemKey in datum) {\n if (!itemKey.startsWith('VGRAMMAR_') && !itemKey.startsWith('__VCHART')) {\n selectedState[itemKey] = datum[itemKey];\n }\n }\n newSelectedDataItemsInChart.push(selectedState);\n }\n //避免无效的更新\n if (!isEqual((table as PivotChart)._selectedDataItemsInChart, newSelectedDataItemsInChart)) {\n (table as PivotChart)._selectedDataItemsInChart = newSelectedDataItemsInChart;\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).updateDataStateToChartInstance();\n // 清楚chart缓存图片\n clearChartCacheImage(scenegraph);\n table.scenegraph.updateNextFrame();\n }\n }\n}\n\n/**\n * @description: update table axis component\n * @param {Group} containerGroup\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction updateTableAxes(containerGroup: Group, table: BaseTableAPI) {\n containerGroup.forEachChildren((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildren((cell: Group) => {\n if (cell.role === 'cell') {\n let isAxisComponent = false;\n cell.forEachChildren((mark: Group) => {\n if (mark.name === 'axis') {\n isAxisComponent = true;\n return true;\n }\n return false;\n });\n if (isAxisComponent) {\n const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(cell.col, cell.row);\n const cellStyle = table._getCellStyle(cell.col, cell.row);\n const padding = getQuadProps(getProp('padding', cellStyle, cell.col, cell.row, table));\n const CartesianAxis: ICartesianAxis = Factory.getComponent('axis');\n const axis = new CartesianAxis(axisConfig, cell.attribute.width, cell.attribute.height, padding, table);\n cell.clear();\n cell.appendChild(axis.component);\n axis.overlap();\n }\n }\n });\n }\n });\n}\n\nfunction updateChartGraphicSize(cellNode: Group, width: number, height: number) {\n cellNode.forEachChildren((graphic: Chart) => {\n if ((graphic as any).type === 'chart') {\n graphic.cacheCanvas = null;\n graphic.setAttributes({\n width: Math.ceil(width - graphic.attribute.cellPadding[3] - graphic.attribute.cellPadding[1]),\n height: Math.ceil(height - graphic.attribute.cellPadding[0] - graphic.attribute.cellPadding[2])\n });\n }\n });\n}\n"]}
|
|
@@ -100,7 +100,7 @@ export declare class Scenegraph {
|
|
|
100
100
|
recreateAllSelectRangeComponents(): void;
|
|
101
101
|
updateColWidth(col: number, detaX: number, skipUpdateContainer?: boolean, skipTableWidthMap?: boolean): void;
|
|
102
102
|
updateChartSizeForResizeColWidth(col: number): void;
|
|
103
|
-
updateChartSizeForResizeRowHeight(
|
|
103
|
+
updateChartSizeForResizeRowHeight(row: number): void;
|
|
104
104
|
updateChartState(datum: any): void;
|
|
105
105
|
updateCheckboxCellState(col: number, row: number, checked: boolean): void;
|
|
106
106
|
updateHeaderCheckboxCellState(col: number, row: number, checked: boolean | 'indeterminate'): void;
|
|
@@ -359,8 +359,8 @@ export class Scenegraph {
|
|
|
359
359
|
updateChartSizeForResizeColWidth(col) {
|
|
360
360
|
updateChartSizeForResizeColWidth(this, col);
|
|
361
361
|
}
|
|
362
|
-
updateChartSizeForResizeRowHeight(
|
|
363
|
-
updateChartSizeForResizeRowHeight(this,
|
|
362
|
+
updateChartSizeForResizeRowHeight(row) {
|
|
363
|
+
updateChartSizeForResizeRowHeight(this, row);
|
|
364
364
|
}
|
|
365
365
|
updateChartState(datum) {
|
|
366
366
|
this.table.isPivotChart() && updateChartState(this, datum);
|
|
@@ -419,7 +419,7 @@ export class Scenegraph {
|
|
|
419
419
|
this.proxy.resize(), ("adaptive" === this.table.widthMode || this.table.autoFillWidth) && (0 === this.table.internalProps._widthResizedColMap.size ? this.recalculateColWidths() : this.dealWidthMode()),
|
|
420
420
|
"adaptive" === this.table.heightMode ? 0 === this.table.internalProps._heightResizedRowMap.size ? this.recalculateRowHeights() : this.dealHeightMode() : this.table.autoFillHeight && this.dealHeightMode(),
|
|
421
421
|
this.resetFrozen(), this.updateTableSize(), this.updateBorderSizeAndPosition(),
|
|
422
|
-
this.component.updateScrollBar(), ("adaptive" === this.table.widthMode || "adaptive" === this.table.heightMode || this.table.autoFillWidth || this.table.autoFillHeight) && this.updateChartSizeForResizeColWidth(
|
|
422
|
+
this.component.updateScrollBar(), ("adaptive" === this.table.widthMode || "adaptive" === this.table.heightMode || this.table.autoFillWidth || this.table.autoFillHeight) && this.updateChartSizeForResizeColWidth(-1),
|
|
423
423
|
this.proxy.progress(), this.updateNextFrame();
|
|
424
424
|
}
|
|
425
425
|
updateTableSize() {
|