@visactor/vtable
Version:
canvas table width high performance
626 lines (603 loc) • 62.8 kB
JavaScript
import { AggregationType } from "./ts-types";
import { PivotHeaderLayoutMap } from "./layout/pivot-header-layout";
import { PIVOT_CHART_EVENT_TYPE } from "./ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE";
import { cellInRange } from "./tools/helper";
import { Dataset } from "./dataset/dataset";
import { parseMarkLineGetExtendRange } from "./core/tableHelper";
import { BaseTable } from "./core/BaseTable";
import { clearCellChartCacheImage, clearChartCacheImage, updateChartData } from "./scenegraph/refresh-node/update-chart";
import { cloneDeep, isArray, isNumber } from "@visactor/vutils";
import { TABLE_EVENT_TYPE } from "./core/TABLE_EVENT_TYPE";
import { cloneDeepSpec } from "@visactor/vutils-extension";
import { DimensionTree } from "./layout/tree-helper";
import { IndicatorDimensionKeyPlaceholder } from "./tools/global";
import { checkHasCartesianChart } from "./layout/chart-helper/get-chart-spec";
import { supplementIndicatorNodesForCustomTree } from "./layout/layout-helper";
import { Factory } from "./core/factory";
import { registerAxis, registerEmptyTip, registerLegend, registerMenu, registerTitle, registerTooltip, registerAnimation } from "./components";
import { registerChartCell, registerCheckboxCell, registerImageCell, registerProgressBarCell, registerRadioCell, registerSparkLineCell, registerTextCell, registerVideoCell } from "./scenegraph/group-creater/cell-type";
import { hasLinearAxis } from "./layout/chart-helper/get-axis-config";
import { cacheStageCanvas, clearChartRenderQueue } from "./scenegraph/graphic/contributions/chart-render-helper";
import { disableTooltipToAllChartInstances, enableTooltipToAllChartInstances } from "./scenegraph/graphic/active-cell-chart-list";
registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(),
registerTooltip(), registerAnimation(), registerChartCell(), registerCheckboxCell(),
registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSparkLineCell(),
registerTextCell(), registerVideoCell();
export class PivotChart extends BaseTable {
constructor(container, options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
let columnDimensionTree, rowDimensionTree;
super(container, options), this.layoutNodeId = {
seqId: 0
}, this._selectedDataItemsInChart = [], this._selectedDataMode = "click", this._selectedDimensionInChart = [],
this._chartEventMap = {}, this._throttleTimer = null, this._latestFilterRules = null,
(options = this.options).layout && Object.assign(options, options.layout), this.internalProps.columns = cloneDeep(options.columns),
this.internalProps.rows = cloneDeep(options.rows), this.internalProps.indicators = cloneDeepSpec(options.indicators),
this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_a = options.columns) || void 0 === _a ? void 0 : _a.length) || options.columnTree ? cloneDeep(options.columnTree) : [],
this.internalProps.rowTree = options.indicatorsAsCol || (null === (_b = options.rows) || void 0 === _b ? void 0 : _b.length) || options.rowTree ? cloneDeep(options.rowTree) : [],
this.internalProps.records = options.records, this.setCustomStateNameToSpec(), this.internalProps.columnResizeType = null !== (_e = null !== (_d = null === (_c = options.resize) || void 0 === _c ? void 0 : _c.columnResizeType) && void 0 !== _d ? _d : options.columnResizeType) && void 0 !== _e ? _e : "column",
this.internalProps.rowResizeType = null !== (_h = null !== (_g = null === (_f = options.resize) || void 0 === _f ? void 0 : _f.rowResizeType) && void 0 !== _g ? _g : options.rowResizeType) && void 0 !== _h ? _h : "row",
this.internalProps.dataConfig = {
isPivotChart: !0
}, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.columnWidthConfigForRowHeader = options.columnWidthConfigForRowHeader,
this._axes = isArray(options.axes) ? options.axes : [], options.columnTree && (!1 !== options.indicatorsAsCol && (this.internalProps.columnTree = supplementIndicatorNodesForCustomTree(this.internalProps.columnTree, options.indicators)),
columnDimensionTree = new DimensionTree(null !== (_j = this.internalProps.columnTree) && void 0 !== _j ? _j : [], this.layoutNodeId)),
options.rowTree && (!1 === options.indicatorsAsCol && (this.internalProps.rowTree = supplementIndicatorNodesForCustomTree(this.internalProps.rowTree, options.indicators)),
rowDimensionTree = new DimensionTree(null !== (_k = this.internalProps.rowTree) && void 0 !== _k ? _k : [], this.layoutNodeId));
const rowKeys = (null === (_l = null == rowDimensionTree ? void 0 : rowDimensionTree.dimensionKeys) || void 0 === _l ? void 0 : _l.count) ? rowDimensionTree.dimensionKeys.valueArr() : null !== (_o = null === (_m = options.rows) || void 0 === _m ? void 0 : _m.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
keys)), [])) && void 0 !== _o ? _o : [], columnKeys = (null === (_p = null == columnDimensionTree ? void 0 : columnDimensionTree.dimensionKeys) || void 0 === _p ? void 0 : _p.count) ? columnDimensionTree.dimensionKeys.valueArr() : null !== (_r = null === (_q = options.columns) || void 0 === _q ? void 0 : _q.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
keys)), [])) && void 0 !== _r ? _r : [], indicatorKeys = null !== (_t = null === (_s = options.indicators) || void 0 === _s ? void 0 : _s.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
keys)), [])) && void 0 !== _t ? _t : [];
if (this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys),
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules(),
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray(),
this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_u = options.indicatorsAsCol) || void 0 === _u || _u, options.records, void 0, void 0, this.internalProps.columnTree, this.internalProps.rowTree, !0),
this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
const supplyAxisNode = nodes => {
nodes.forEach((node => {
var _a;
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? supplyAxisNode(node.children) : node.children = [ {
dimensionKey: "axis",
value: ""
} ];
}));
};
(null === (_v = this.dataset.rowHeaderTree) || void 0 === _v ? void 0 : _v.length) ? supplyAxisNode(this.dataset.rowHeaderTree) : this.dataset.rowHeaderTree = [ {
dimensionKey: "axis",
value: ""
} ];
}
if (options.columnTree || !1 !== options.indicatorsAsCol && (this.dataset.colHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.colHeaderTree, options.indicators)),
options.rowTree || !1 === options.indicatorsAsCol && (this.dataset.rowHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.rowHeaderTree, options.indicators)),
columnDimensionTree = new DimensionTree(null !== (_w = this.dataset.colHeaderTree) && void 0 !== _w ? _w : [], this.layoutNodeId),
rowDimensionTree = new DimensionTree(null !== (_x = this.dataset.rowHeaderTree) && void 0 !== _x ? _x : [], this.layoutNodeId),
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.createSceneGraph(),
options.title) {
const Title = Factory.getComponent("title");
this.internalProps.title = new Title(options.title, this);
}
if (this.options.emptyTip) if (this.internalProps.emptyTip) null === (_y = this.internalProps.emptyTip) || void 0 === _y || _y.resetVisible(); else {
const EmptyTip = Factory.getComponent("emptyTip");
this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_z = this.internalProps.emptyTip) || void 0 === _z || _z.resetVisible();
}
this.resize(), setTimeout((() => {
this.isReleased || this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
}), 0);
}
static get EVENT_TYPE() {
return PIVOT_CHART_EVENT_TYPE;
}
get pivotChartAxes() {
return this._axes;
}
get recordsCount() {
var _a;
return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
}
isListTable() {
return !1;
}
isPivotTable() {
return !0;
}
isPivotChart() {
return !0;
}
_canResizeColumn(col, row) {
const ifCan = super._canResizeColumn(col, row);
if (ifCan && !this.internalProps.layoutMap.indicatorsAsCol) {
const cellDefine = this.internalProps.layoutMap.getBody(col, this.columnHeaderLevelCount);
if (null == cellDefine ? void 0 : cellDefine.disableColumnResize) return !1;
}
return ifCan;
}
updateOption(options, updateConfig = {
clearColWidthCache: !0,
clearRowHeightCache: !0
}) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
const internalProps = this.internalProps;
let columnDimensionTree, rowDimensionTree;
super.updateOption(options, updateConfig), this.scenegraph.updateChartState(null, void 0),
this.scenegraph.deactivateChart(-1, -1, !0), this.layoutNodeId = {
seqId: 0
}, this.internalProps.columns = cloneDeep(options.columns), this.internalProps.rows = cloneDeep(options.rows),
this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? cloneDeepSpec(options.indicators) : [],
this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_b = options.columns) || void 0 === _b ? void 0 : _b.length) || options.columnTree ? cloneDeep(options.columnTree) : [],
this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? cloneDeep(options.rowTree) : [],
options.records && (this.internalProps.records = options.records), this.setCustomStateNameToSpec(),
this._selectedDataItemsInChart = [], internalProps.columnResizeType = null !== (_f = null !== (_e = null === (_d = options.resize) || void 0 === _d ? void 0 : _d.columnResizeType) && void 0 !== _e ? _e : options.columnResizeType) && void 0 !== _f ? _f : "column",
internalProps.rowResizeType = null !== (_j = null !== (_h = null === (_g = options.resize) || void 0 === _g ? void 0 : _g.rowResizeType) && void 0 !== _h ? _h : options.rowResizeType) && void 0 !== _j ? _j : "row",
internalProps.dataConfig = {
isPivotChart: !0
}, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.internalProps.columnWidthConfigForRowHeader = options.columnWidthConfigForRowHeader,
this._axes = isArray(options.axes) ? options.axes : [], options.columnTree && (!1 !== options.indicatorsAsCol && (this.internalProps.columnTree = supplementIndicatorNodesForCustomTree(this.internalProps.columnTree, options.indicators)),
columnDimensionTree = new DimensionTree(null !== (_k = this.internalProps.columnTree) && void 0 !== _k ? _k : [], this.layoutNodeId)),
options.rowTree && (!1 === options.indicatorsAsCol && (this.internalProps.rowTree = supplementIndicatorNodesForCustomTree(this.internalProps.rowTree, options.indicators)),
rowDimensionTree = new DimensionTree(null !== (_l = this.internalProps.rowTree) && void 0 !== _l ? _l : [], this.layoutNodeId));
const rowKeys = (null === (_m = null == rowDimensionTree ? void 0 : rowDimensionTree.dimensionKeys) || void 0 === _m ? void 0 : _m.count) ? rowDimensionTree.dimensionKeys.valueArr() : null !== (_p = null === (_o = options.rows) || void 0 === _o ? void 0 : _o.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
keys)), [])) && void 0 !== _p ? _p : [], columnKeys = (null === (_q = null == columnDimensionTree ? void 0 : columnDimensionTree.dimensionKeys) || void 0 === _q ? void 0 : _q.count) ? columnDimensionTree.dimensionKeys.valueArr() : null !== (_s = null === (_r = options.columns) || void 0 === _r ? void 0 : _r.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
keys)), [])) && void 0 !== _s ? _s : [], indicatorKeys = null !== (_u = null === (_t = options.indicators) || void 0 === _t ? void 0 : _t.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
keys)), [])) && void 0 !== _u ? _u : [];
if (this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys),
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules(),
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray(),
this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_v = options.indicatorsAsCol) || void 0 === _v || _v, null !== (_w = options.records) && void 0 !== _w ? _w : this.internalProps.records, void 0, void 0, this.internalProps.columnTree, this.internalProps.rowTree, !0),
this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
const supplyAxisNode = nodes => {
nodes.forEach((node => {
var _a;
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? supplyAxisNode(node.children) : node.children = [ {
dimensionKey: "axis",
value: ""
} ];
}));
};
(null === (_x = this.dataset.rowHeaderTree) || void 0 === _x ? void 0 : _x.length) ? supplyAxisNode(this.dataset.rowHeaderTree) : this.dataset.rowHeaderTree = [ {
dimensionKey: "axis",
value: ""
} ];
}
if (options.columnTree || !1 !== options.indicatorsAsCol && (this.dataset.colHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.colHeaderTree, options.indicators)),
options.rowTree || !1 === options.indicatorsAsCol && (this.dataset.rowHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.rowHeaderTree, options.indicators)),
columnDimensionTree = new DimensionTree(null !== (_y = this.dataset.colHeaderTree) && void 0 !== _y ? _y : [], this.layoutNodeId),
rowDimensionTree = new DimensionTree(null !== (_z = this.dataset.rowHeaderTree) && void 0 !== _z ? _z : [], this.layoutNodeId),
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
var _a;
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
})), internalProps.releaseList = null), this.scenegraph.clearCells(), this.scenegraph.createSceneGraph(),
options.title) {
const Title = Factory.getComponent("title");
this.internalProps.title = new Title(options.title, this);
}
if (this.options.emptyTip) if (this.internalProps.emptyTip) null === (_0 = this.internalProps.emptyTip) || void 0 === _0 || _0.resetVisible(); else {
const EmptyTip = Factory.getComponent("emptyTip");
this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_1 = this.internalProps.emptyTip) || void 0 === _1 || _1.resetVisible();
}
return this.resize(), setTimeout((() => {
this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
}), 0), new Promise((resolve => {
setTimeout(resolve, 0);
}));
}
updatePagination() {}
refreshHeader() {
this.setMinMaxLimitWidth(!0), this.refreshRowColCount();
}
refreshRowColCount() {
var _a, _b, _c, _d, _e, _f, _g, _h;
const table = this, {layoutMap: layoutMap} = table.internalProps;
layoutMap && (table.colCount = null !== (_a = layoutMap.colCount) && void 0 !== _a ? _a : 0,
table.rowCount = null !== (_b = layoutMap.rowCount) && void 0 !== _b ? _b : 0, table.internalProps.frozenColCount = null !== (_c = layoutMap.rowHeaderLevelCount) && void 0 !== _c ? _c : 0,
table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, null !== (_d = this.options.frozenRowCount) && void 0 !== _d ? _d : 0)),
table.bottomFrozenRowCount !== (null !== (_e = null == layoutMap ? void 0 : layoutMap.bottomFrozenRowCount) && void 0 !== _e ? _e : 0) && (table.bottomFrozenRowCount = null !== (_f = null == layoutMap ? void 0 : layoutMap.bottomFrozenRowCount) && void 0 !== _f ? _f : 0),
table.rightFrozenColCount !== (null !== (_g = null == layoutMap ? void 0 : layoutMap.rightFrozenColCount) && void 0 !== _g ? _g : 0) && (table.rightFrozenColCount = null !== (_h = null == layoutMap ? void 0 : layoutMap.rightFrozenColCount) && void 0 !== _h ? _h : 0),
this.stateManager.setFrozenCol(this.internalProps.frozenColCount));
}
_getSortFuncFromHeaderOption(columns, field, fieldKey) {}
syncHierarchyState(sourceNode, targetNode) {
var _a, _b;
sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey && (targetNode.hierarchyState = null !== (_a = targetNode.hierarchyState) && void 0 !== _a ? _a : (null == targetNode ? void 0 : targetNode.children) ? sourceNode.hierarchyState : void 0,
null === (_b = null == targetNode ? void 0 : targetNode.children) || void 0 === _b || _b.forEach(((targetChildNode, index) => {
var _a;
(null === (_a = null == sourceNode ? void 0 : sourceNode.children) || void 0 === _a ? void 0 : _a[index]) && targetChildNode && this.syncHierarchyState(sourceNode.children[index], targetChildNode);
})));
}
getRecordShowIndexByCell(col, row) {}
getTableIndexByRecordIndex(recordIndex) {}
getTableIndexByField(field) {}
getCellAddrByFieldRecord(field, recordIndex) {}
getBodyIndexByRow(row) {
const {layoutMap: layoutMap} = this.internalProps;
return layoutMap.getBodyIndexByRow(row);
}
getBodyIndexByCol(col) {
const {layoutMap: layoutMap} = this.internalProps;
return layoutMap.getBodyIndexByCol(col);
}
getCellValue(col, row, skipCustomMerge) {
var _a, _b, _c;
if (!skipCustomMerge) {
const customMergeText = this.getCustomMergeValue(col, row);
if (customMergeText) return customMergeText;
}
if (this.internalProps.layoutMap.isHeader(col, row)) {
if (this.internalProps.layoutMap.isBottomFrozenRow(col, row) || this.internalProps.layoutMap.isRightFrozenColumn(col, row)) {
const indicatorKeys = this.internalProps.layoutMap.getIndicatorKeyInChartSpec(col, row);
let indicatorInfo;
return null == indicatorKeys || indicatorKeys.forEach((key => {
const info = this.internalProps.layoutMap.getIndicatorInfo(key);
info && (indicatorInfo = info);
})), null !== (_b = null !== (_a = null == indicatorInfo ? void 0 : indicatorInfo.title) && void 0 !== _a ? _a : null == indicatorInfo ? void 0 : indicatorInfo.indicatorKey) && void 0 !== _b ? _b : "";
}
const {title: title, fieldFormat: fieldFormat} = this.internalProps.layoutMap.getHeader(col, row);
return "function" == typeof fieldFormat ? fieldFormat(title, col, row, this) : title;
}
if (this.dataset) {
let indicatorPosition;
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map(((colPath, index) => {
var _a;
return colPath.indicatorKey && (indicatorPosition = {
position: "col",
index: index
}), null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
})), rowKeys = cellDimensionPath.rowHeaderPaths.map(((rowPath, index) => {
var _a;
return rowPath.indicatorKey && (indicatorPosition = {
position: "row",
index: index
}), null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
})), aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), !0, indicatorPosition);
return aggregator.value ? aggregator.value() : void 0;
}
const {fieldFormat: fieldFormat} = this.internalProps.layoutMap.getBody(col, row), rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col), dataValue = null === (_c = this.records[rowIndex]) || void 0 === _c ? void 0 : _c[colIndex];
if ("function" == typeof fieldFormat) {
return fieldFormat(dataValue, col, row, this);
}
return dataValue;
}
getCellOriginValue(col, row) {
var _a, _b, _c;
const table = this;
if (table.internalProps.layoutMap.isHeader(col, row)) {
if (this.internalProps.layoutMap.isBottomFrozenRow(col, row) || this.internalProps.layoutMap.isRightFrozenColumn(col, row)) {
const indicatorKeys = this.internalProps.layoutMap.getIndicatorKeyInChartSpec(col, row);
let indicatorInfo;
return null == indicatorKeys || indicatorKeys.forEach((key => {
const info = this.internalProps.layoutMap.getIndicatorInfo(key);
info && (indicatorInfo = info);
})), null !== (_b = null !== (_a = null == indicatorInfo ? void 0 : indicatorInfo.title) && void 0 !== _a ? _a : null == indicatorInfo ? void 0 : indicatorInfo.indicatorKey) && void 0 !== _b ? _b : "";
}
const {title: title} = table.internalProps.layoutMap.getHeader(col, row);
return "function" == typeof title ? title() : title;
}
if (this.dataset) {
let indicatorPosition;
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map(((colPath, index) => {
var _a;
return colPath.indicatorKey && (indicatorPosition = {
position: "col",
index: index
}), null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
})), rowKeys = cellDimensionPath.rowHeaderPaths.map(((rowPath, index) => {
var _a;
return rowPath.indicatorKey && (indicatorPosition = {
position: "row",
index: index
}), null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
})), aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), !0, indicatorPosition);
return aggregator.value ? aggregator.value() : void 0;
}
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
return null === (_c = this.records[rowIndex]) || void 0 === _c ? void 0 : _c[colIndex];
}
getCellRawValue(col, row) {
return this.getCellOriginValue(col, row);
}
getCellOriginRecord(col, row) {
if (!this.internalProps.layoutMap.isHeader(col, row) && this.dataset) {
let indicatorPosition;
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map(((colPath, index) => {
var _a;
return colPath.indicatorKey && (indicatorPosition = {
position: "col",
index: index
}), null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
})), rowKeys = cellDimensionPath.rowHeaderPaths.map(((rowPath, index) => {
var _a;
return rowPath.indicatorKey && (indicatorPosition = {
position: "row",
index: index
}), null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
}));
return this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), !0, indicatorPosition).records;
}
}
getCellRawRecord(col, row) {
return this.getCellOriginRecord(col, row);
}
getPivotSortState(col, row) {
if (!this.pivotSortState) return;
const cellRange = this.getCellRange(col, row);
for (let i = 0; i < this.pivotSortState.length; i++) {
const {col: sortCol, row: sortRow, order: order} = this.pivotSortState[i];
if (cellInRange(cellRange, sortCol, sortRow)) return order;
}
}
_moveHeaderPosition(source, target) {
var _a, _b, _c, _d;
const moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
if (moveContext) {
if ("column" === moveContext.moveType) {
if ((null === (_b = null === (_a = this.options.records) || void 0 === _a ? void 0 : _a[0]) || void 0 === _b ? void 0 : _b.constructor) === Array) for (let row = 0; row < this.internalProps.records.length; row++) {
const sourceColumns = this.internalProps.records[row].splice(moveContext.sourceIndex - this.rowHeaderLevelCount, moveContext.sourceSize);
sourceColumns.unshift(moveContext.targetIndex - this.rowHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records[row], sourceColumns);
}
this.colWidthsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.sourceSize),
this.setMinMaxLimitWidth();
} else if ("row" === moveContext.moveType) {
if ((null === (_d = null === (_c = this.options.records) || void 0 === _c ? void 0 : _c[0]) || void 0 === _d ? void 0 : _d.constructor) === Array) {
const sourceRows = this.internalProps.records.splice(moveContext.sourceIndex - this.columnHeaderLevelCount, moveContext.sourceSize);
sourceRows.unshift(moveContext.targetIndex - this.columnHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records, sourceRows);
}
this.rowHeightsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.sourceSize);
}
return moveContext;
}
return null;
}
toggleHierarchyState(col, row, recalculateColWidths = !0) {}
getHeaderCellAddressByPath(dimensionPaths) {
return this.internalProps.layoutMap.getPivotCellAdress(dimensionPaths);
}
getCellAddressByHeaderPaths(dimensionPaths) {
return this.internalProps.layoutMap.getCellAdressByHeaderPath(dimensionPaths);
}
getHeaderPathByXY(coordinate) {
let cellAddr;
cellAddr = coordinate ? this.getCellAt(coordinate.x + this.getFrozenColsWidth() + this.scrollLeft + 1, coordinate.y + this.getFrozenRowsHeight() + this.scrollTop + 1) : this.getCellAt(this.getFrozenColsWidth() + this.scrollLeft + 1, this.getFrozenRowsHeight() + this.scrollTop + 1);
return this.internalProps.layoutMap.getCellHeaderPaths(cellAddr.col, cellAddr.row);
}
getHierarchyState(col, row) {
var _a;
return null === (_a = this._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.hierarchyState;
}
getMenuInfo(col, row, type) {
const dimensionInfos = this.internalProps.layoutMap.getPivotDimensionInfo(col, row);
return {
dimensionKey: dimensionInfos[dimensionInfos.length - 1].dimensionKey,
value: this.getCellValue(col, row),
cellLocation: this.getCellLocation(col, row),
isPivotCorner: this.isCornerHeader(col, row),
event: void 0
};
}
_generateCollectValuesConfig(columnKeys, rowKeys) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
columnKeys = columnKeys.filter((key => key !== IndicatorDimensionKeyPlaceholder)),
rowKeys = rowKeys.filter((key => key !== IndicatorDimensionKeyPlaceholder));
const indicators = this.internalProps.indicators, collectValuesBy = {};
for (let i = 0, len = null == indicators ? void 0 : indicators.length; i < len; i++) if ("string" != typeof indicators[i] && indicators[i].chartSpec) {
if ("pie" === (null === (_a = indicators[i].chartSpec) || void 0 === _a ? void 0 : _a.type) || "rose" === (null === (_b = indicators[i].chartSpec) || void 0 === _b ? void 0 : _b.type) || "funnel" === (null === (_c = indicators[i].chartSpec) || void 0 === _c ? void 0 : _c.type) || "radar" === (null === (_d = indicators[i].chartSpec) || void 0 === _d ? void 0 : _d.type) || "gauge" === (null === (_e = indicators[i].chartSpec) || void 0 === _e ? void 0 : _e.type) || "wordCloud" === (null === (_f = indicators[i].chartSpec) || void 0 === _f ? void 0 : _f.type) || "sunburst" === (null === (_g = indicators[i].chartSpec) || void 0 === _g ? void 0 : _g.type) || "treemap" === (null === (_h = indicators[i].chartSpec) || void 0 === _h ? void 0 : _h.type) || "sankey" === (null === (_j = indicators[i].chartSpec) || void 0 === _j ? void 0 : _j.type) || "circlePacking" === (null === (_k = indicators[i].chartSpec) || void 0 === _k ? void 0 : _k.type)) continue;
const indicatorDefine = indicators[i], indicatorSpec = indicatorDefine.chartSpec;
if (!1 === this.options.indicatorsAsCol) if (!1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0),
"heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
by: rowKeys,
range: !0,
sumBy: "histogram" === indicatorSpec.type ? columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField, null == indicatorSpec ? void 0 : indicatorSpec.x2Field) : (null == indicatorSpec ? void 0 : indicatorSpec.stack) && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField)
}), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const xField = "string" == typeof chartSeries.xField ? chartSeries.xField : chartSeries.xField[0];
collectValuesBy[xField] = {
by: columnKeys,
type: "horizontal" !== chartSeries.direction ? "xField" : void 0,
range: hasLinearAxis(chartSeries, this._axes, "horizontal" === chartSeries.direction, !0),
sortBy: "horizontal" !== chartSeries.direction ? null !== (_d = null === (_c = null === (_b = null === (_a = null == chartSeries ? void 0 : chartSeries.data) || void 0 === _a ? void 0 : _a.fields) || void 0 === _b ? void 0 : _b[xField]) || void 0 === _c ? void 0 : _c.domain) && void 0 !== _d ? _d : null === (_g = null === (_f = null === (_e = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _e ? void 0 : _e.fields) || void 0 === _f ? void 0 : _f[xField]) || void 0 === _g ? void 0 : _g.domain : void 0
};
const yField = chartSeries.yField;
!1 !== chartSeries.stack && ("bar" === chartSeries.type || "area" === chartSeries.type) && (chartSeries.stack = !0),
collectValuesBy[yField] = {
by: rowKeys,
range: hasLinearAxis(chartSeries, this._axes, "horizontal" === chartSeries.direction, !1),
sumBy: chartSeries.stack && columnKeys.concat(null == chartSeries ? void 0 : chartSeries.xField),
sortBy: "horizontal" === chartSeries.direction ? null !== (_l = null === (_k = null === (_j = null === (_h = null == chartSeries ? void 0 : chartSeries.data) || void 0 === _h ? void 0 : _h.fields) || void 0 === _j ? void 0 : _j[yField]) || void 0 === _k ? void 0 : _k.domain) && void 0 !== _l ? _l : null === (_p = null === (_o = null === (_m = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _m ? void 0 : _m.fields) || void 0 === _o ? void 0 : _o[yField]) || void 0 === _p ? void 0 : _p.domain : void 0,
extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
};
})); else {
const xField = "histogram" === indicatorSpec.type ? indicatorSpec.x2Field : "string" == typeof indicatorSpec.xField ? indicatorSpec.xField : indicatorSpec.xField[0];
collectValuesBy[xField] = {
by: columnKeys,
type: "horizontal" !== indicatorSpec.direction ? "xField" : void 0,
range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
sortBy: "horizontal" !== indicatorSpec.direction ? null === (_o = null === (_m = null === (_l = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _l ? void 0 : _l.fields) || void 0 === _m ? void 0 : _m[xField]) || void 0 === _o ? void 0 : _o.domain : void 0
}, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
const yField = null !== (_p = indicatorSpec.yField) && void 0 !== _p ? _p : indicatorSpec.maxField;
collectValuesBy[yField] = {
by: rowKeys,
type: "horizontal" !== indicatorSpec.direction ? "yField" : void 0,
range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
sumBy: "histogram" === indicatorSpec.type ? columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField, null == indicatorSpec ? void 0 : indicatorSpec.x2Field) : indicatorSpec.stack && columnKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.xField),
sortBy: "horizontal" === indicatorSpec.direction ? null === (_s = null === (_r = null === (_q = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _q ? void 0 : _q.fields) || void 0 === _r ? void 0 : _r[yField]) || void 0 === _s ? void 0 : _s.domain : void 0,
extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine),
considerFields: "boxPlot" === (null == indicatorSpec ? void 0 : indicatorSpec.type) ? [ indicatorSpec.maxField, indicatorSpec.minField, indicatorSpec.outliersField ] : void 0
};
} else {
const indicatorDefine = indicators[i];
if (!1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0),
"heatmap" !== (null == indicatorSpec ? void 0 : indicatorSpec.type) && (collectValuesBy[indicatorDefine.indicatorKey] = {
by: columnKeys,
range: !0,
sumBy: "histogram" === indicatorSpec.type ? rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField, null == indicatorSpec ? void 0 : indicatorSpec.y2Field) : (null == indicatorSpec ? void 0 : indicatorSpec.stack) && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField)
}), indicatorSpec.series) indicatorSpec.series.forEach((chartSeries => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const yField = "string" == typeof chartSeries.yField ? chartSeries.yField : chartSeries.yField[0];
collectValuesBy[yField] = {
by: rowKeys,
type: "horizontal" === chartSeries.direction ? "yField" : void 0,
range: hasLinearAxis(chartSeries, this._axes, "horizontal" === chartSeries.direction, !1),
sortBy: "horizontal" === chartSeries.direction ? null !== (_d = null === (_c = null === (_b = null === (_a = null == chartSeries ? void 0 : chartSeries.data) || void 0 === _a ? void 0 : _a.fields) || void 0 === _b ? void 0 : _b[yField]) || void 0 === _c ? void 0 : _c.domain) && void 0 !== _d ? _d : null === (_g = null === (_f = null === (_e = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _e ? void 0 : _e.fields) || void 0 === _f ? void 0 : _f[yField]) || void 0 === _g ? void 0 : _g.domain : void 0
};
const xField = chartSeries.xField;
!1 !== chartSeries.stack && ("bar" === chartSeries.type || "area" === chartSeries.type) && (chartSeries.stack = !0),
collectValuesBy[xField] = {
by: columnKeys,
range: hasLinearAxis(chartSeries, this._axes, "horizontal" === chartSeries.direction, !0),
sumBy: chartSeries.stack && rowKeys.concat(null == chartSeries ? void 0 : chartSeries.yField),
sortBy: "horizontal" !== chartSeries.direction ? null !== (_l = null === (_k = null === (_j = null === (_h = null == chartSeries ? void 0 : chartSeries.data) || void 0 === _h ? void 0 : _h.fields) || void 0 === _j ? void 0 : _j[xField]) || void 0 === _k ? void 0 : _k.domain) && void 0 !== _l ? _l : null === (_p = null === (_o = null === (_m = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _m ? void 0 : _m.fields) || void 0 === _o ? void 0 : _o[xField]) || void 0 === _p ? void 0 : _p.domain : void 0,
extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
};
})); else {
const yField = "histogram" === indicatorSpec.type ? indicatorSpec.y2Field : "string" == typeof indicatorSpec.yField ? indicatorSpec.yField : indicatorSpec.yField[0];
collectValuesBy[yField] = {
by: rowKeys,
type: "horizontal" === indicatorSpec.direction ? "yField" : void 0,
range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !1),
sortBy: "horizontal" === indicatorSpec.direction ? null === (_v = null === (_u = null === (_t = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _t ? void 0 : _t.fields) || void 0 === _u ? void 0 : _u[yField]) || void 0 === _v ? void 0 : _v.domain : void 0
}, !1 !== (null == indicatorSpec ? void 0 : indicatorSpec.stack) && ("bar" === (null == indicatorSpec ? void 0 : indicatorSpec.type) || "area" === (null == indicatorSpec ? void 0 : indicatorSpec.type)) && (indicatorSpec.stack = !0);
const xField = null !== (_w = indicatorSpec.xField) && void 0 !== _w ? _w : indicatorSpec.maxField;
collectValuesBy[xField] = {
by: columnKeys,
type: "horizontal" === indicatorSpec.direction ? "xField" : void 0,
range: hasLinearAxis(indicatorSpec, this._axes, "horizontal" === indicatorSpec.direction, !0),
sumBy: "histogram" === indicatorSpec.type ? rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField, null == indicatorSpec ? void 0 : indicatorSpec.y2Field) : indicatorSpec.stack && rowKeys.concat(null == indicatorSpec ? void 0 : indicatorSpec.yField),
sortBy: "horizontal" !== indicatorSpec.direction ? null === (_z = null === (_y = null === (_x = null == indicatorSpec ? void 0 : indicatorSpec.data) || void 0 === _x ? void 0 : _x.fields) || void 0 === _y ? void 0 : _y[xField]) || void 0 === _z ? void 0 : _z.domain : void 0,
extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine),
considerFields: "boxPlot" === (null == indicatorSpec ? void 0 : indicatorSpec.type) ? [ indicatorSpec.maxField, indicatorSpec.minField, indicatorSpec.outliersField ] : void 0
};
}
}
}
return collectValuesBy;
}
_generateAggregationRules() {
var _a;
const aggregationRules = [];
return null === (_a = this.internalProps.indicators) || void 0 === _a || _a.forEach((indicator => {
var _a, _b;
if ("string" == typeof indicator) aggregationRules.push({
indicatorKey: indicator,
field: indicator,
aggregationType: AggregationType.RECORD
}); else if (null === (_a = indicator.chartSpec) || void 0 === _a ? void 0 : _a.series) {
const fields = [];
null === (_b = indicator.chartSpec) || void 0 === _b || _b.series.forEach((seriesSpec => {
const seriesField = !1 === this.options.indicatorsAsCol ? seriesSpec.yField : seriesSpec.xField;
-1 === fields.indexOf(seriesField) && fields.push(seriesField);
})), aggregationRules.push({
indicatorKey: indicator.indicatorKey,
field: fields,
aggregationType: AggregationType.RECORD
});
} else {
const field = !1 === this.options.indicatorsAsCol ? indicator.chartSpec.yField : indicator.chartSpec.xField;
aggregationRules.push({
indicatorKey: indicator.indicatorKey,
field: null != field ? field : indicator.indicatorKey,
aggregationType: AggregationType.RECORD
});
}
})), aggregationRules;
}
setCustomStateNameToSpec() {
var _a;
const setCustomStateName = spec => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
(null === (_b = null === (_a = spec.bar) || void 0 === _a ? void 0 : _a.state) || void 0 === _b ? void 0 : _b.selected) && (spec.bar.state.vtable_selected = spec.bar.state.selected,
spec.bar.state.vtable_selected_reverse = spec.bar.state.selected_reverse, delete spec.bar.state.selected,
delete spec.bar.state.selected_reverse), (null === (_d = null === (_c = spec.point) || void 0 === _c ? void 0 : _c.state) || void 0 === _d ? void 0 : _d.selected) && (spec.point.state.vtable_selected = spec.point.state.selected,
spec.point.state.vtable_selected_reverse = spec.point.state.selected_reverse, delete spec.point.state.selected,
delete spec.point.state.selected_reverse), (null === (_f = null === (_e = spec.line) || void 0 === _e ? void 0 : _e.state) || void 0 === _f ? void 0 : _f.selected) && (spec.line.state.vtable_selected = spec.line.state.selected,
spec.line.state.vtable_selected_reverse = spec.line.state.selected_reverse, delete spec.line.state.selected,
delete spec.line.state.selected_reverse), (null === (_h = null === (_g = spec.area) || void 0 === _g ? void 0 : _g.state) || void 0 === _h ? void 0 : _h.selected) && (spec.area.state.vtable_selected = spec.area.state.selected,
spec.area.state.vtable_selected_reverse = spec.area.state.selected_reverse, delete spec.area.state.selected,
delete spec.area.state.selected_reverse), (null === (_k = null === (_j = spec.pie) || void 0 === _j ? void 0 : _j.state) || void 0 === _k ? void 0 : _k.selected) && (spec.pie.state.vtable_selected = spec.pie.state.selected,
spec.pie.state.vtable_selected_reverse = spec.pie.state.selected_reverse, delete spec.pie.state.selected,
delete spec.pie.state.selected_reverse);
};
null === (_a = this.internalProps.indicators) || void 0 === _a || _a.forEach((indicator => {
if (indicator.chartSpec) {
const spec = indicator.chartSpec;
spec.series ? spec.series.forEach((series => {
setCustomStateName(series);
})) : setCustomStateName(spec);
}
}));
}
updateFilterRules(filterRules) {
this._throttledUpdateFilterRules(filterRules);
}
_throttledUpdateFilterRules(filterRules) {
this._latestFilterRules = filterRules, null === this._throttleTimer && (this._executeFilterUpdate(filterRules),
this._throttleTimer = window.setTimeout((() => {
this._latestFilterRules !== filterRules && this._executeFilterUpdate(this._latestFilterRules),
this._throttleTimer = null;
}), 200));
}
_executeFilterUpdate(filterRules) {
this.internalProps.dataConfig.filterRules = filterRules, this.dataset.updateFilterRules(filterRules),
clearChartCacheImage(this.scenegraph), updateChartData(this.scenegraph), this.render();
}
clearChartCacheImage(col, row) {
isNumber(col) && isNumber(row) ? clearCellChartCacheImage(col, row, this.scenegraph) : clearChartCacheImage(this.scenegraph);
}
getLegendSelected() {
var _a;
const selected = [];
return null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
const data = legend.legendComponent._getSelectedLegends().map((d => d.label));
selected.push(...data);
})), selected;
}
setLegendSelected(selectedData) {
var _a;
null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach((legend => {
legend.legendComponent.setSelected(selectedData);
}));
}
getChartDatumPosition(datum, cellHeaderPaths) {
const {chartInstance: chartInstance, bounds: bounds} = this.getChartInstance(cellHeaderPaths);
if (chartInstance) {
const position = chartInstance.convertDatumToPosition(datum);
return position ? {
x: Math.round(position.x + bounds.x1),
y: Math.round(position.y + bounds.y1)
} : null;
}
return null;
}
getCellAddressByRecord(record) {
const rowHeaderPaths = [], colHeaderPaths = [], recordKeyMapToIndicatorKeys = {}, indicatorRecordKeys = [];
this.dataset.dataConfig.aggregationRules.forEach((aggregationRule => {
if ("string" == typeof aggregationRule.field) recordKeyMapToIndicatorKeys[aggregationRule.field] = aggregationRule.indicatorKey,
indicatorRecordKeys.push(aggregationRule.field); else for (let i = 0; i < aggregationRule.field.length; i++) recordKeyMapToIndicatorKeys[aggregationRule.field[i]] = aggregationRule.indicatorKey,
indicatorRecordKeys.push(aggregationRule.field[i]);
}));
for (const key in record) this.dataset.rows.indexOf(key) >= 0 && rowHeaderPaths.push({
dimensionKey: key,
value: record[key]
}), this.dataset.columns.indexOf(key) >= 0 && colHeaderPaths.push({
dimensionKey: key,
value: record[key]
}), indicatorRecordKeys.indexOf(key) >= 0 && (this.dataset.indicatorsAsCol ? colHeaderPaths.push({
indicatorKey: recordKeyMapToIndicatorKeys[key]
}) : rowHeaderPaths.push({
indicatorKey: recordKeyMapToIndicatorKeys[key]
}));
return this.getCellAddressByHeaderPaths({
rowHeaderPaths: rowHeaderPaths,
colHeaderPaths: colHeaderPaths,
cellLocation: "body"
});
}
getChartInstance(cellHeaderPaths) {
var _a, _b, _c, _d, _e;
const cellAddr = this.getCellAddressByHeaderPaths(cellHeaderPaths);
if (cellAddr) {
const cellPosition = this.getCellRelativeRect(cellAddr.col, cellAddr.row), cellGroup = this.scenegraph.getCell(cellAddr.col, cellAddr.row);
let chartInstance;
const chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
if (chartNode.attribute.chartInstance) {
chartInstance = chartNode.attribute.chartInstance;
const {dataId: dataId, data: data, axes: axes, spec: spec} = chartNode.attribute, viewBox = chartNode.getViewBox();