@visactor/vtable 1.16.2 → 1.16.3-alpha.1
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/PivotChart.d.ts +2 -0
- package/cjs/PivotChart.js +60 -1
- package/cjs/PivotChart.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/layout/index.js +2 -1
- package/cjs/layout/pivot-header-layout.js +0 -1
- package/cjs/scenegraph/graphic/chart.js +4 -4
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.d.ts +2 -0
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +3 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -1
- package/cjs/scenegraph/scenegraph.js +3 -2
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +78 -2
- package/dist/vtable.min.js +1 -1
- package/es/PivotChart.d.ts +2 -0
- package/es/PivotChart.js +61 -0
- package/es/PivotChart.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/layout/index.js +2 -1
- package/es/layout/pivot-header-layout.js +1 -2
- package/es/scenegraph/graphic/chart.js +4 -4
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.d.ts +2 -0
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -1
- package/es/scenegraph/scenegraph.js +3 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
package/cjs/PivotChart.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ export declare class PivotChart extends BaseTable implements PivotChartAPI {
|
|
|
86
86
|
chartInstance?: undefined;
|
|
87
87
|
bounds?: undefined;
|
|
88
88
|
};
|
|
89
|
+
activateChartInstance(cellHeaderPaths: IPivotTableCellHeaderPaths): any;
|
|
90
|
+
replaceChartCacheImage(cellHeaderPaths: IPivotTableCellHeaderPaths, chartInstance: any): void;
|
|
89
91
|
_getDimensionSortArray(): string[] | undefined;
|
|
90
92
|
setRecords(records: Array<any>): void;
|
|
91
93
|
_hasCustomRenderOrLayout(): boolean;
|
package/cjs/PivotChart.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.PivotChart = void 0;
|
|
6
6
|
|
|
7
|
-
const ts_types_1 = require("./ts-types"), pivot_header_layout_1 = require("./layout/pivot-header-layout"), PIVOT_TABLE_EVENT_TYPE_1 = require("./ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE"), helper_1 = require("./tools/helper"), dataset_1 = require("./dataset/dataset"), tableHelper_1 = require("./core/tableHelper"), BaseTable_1 = require("./core/BaseTable"), update_chart_1 = require("./scenegraph/refresh-node/update-chart"), vutils_1 = require("@visactor/vutils"), env_1 = require("./tools/env"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), vutils_extension_1 = require("@visactor/vutils-extension"), tree_helper_1 = require("./layout/tree-helper"), global_1 = require("./tools/global"), get_chart_spec_1 = require("./layout/chart-helper/get-chart-spec"), layout_helper_1 = require("./layout/layout-helper"), factory_1 = require("./core/factory"), components_1 = require("./components"), cell_type_1 = require("./scenegraph/group-creater/cell-type"), get_axis_config_1 = require("./layout/chart-helper/get-axis-config");
|
|
7
|
+
const ts_types_1 = require("./ts-types"), pivot_header_layout_1 = require("./layout/pivot-header-layout"), PIVOT_TABLE_EVENT_TYPE_1 = require("./ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE"), helper_1 = require("./tools/helper"), dataset_1 = require("./dataset/dataset"), tableHelper_1 = require("./core/tableHelper"), BaseTable_1 = require("./core/BaseTable"), update_chart_1 = require("./scenegraph/refresh-node/update-chart"), vutils_1 = require("@visactor/vutils"), env_1 = require("./tools/env"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), vutils_extension_1 = require("@visactor/vutils-extension"), tree_helper_1 = require("./layout/tree-helper"), global_1 = require("./tools/global"), get_chart_spec_1 = require("./layout/chart-helper/get-chart-spec"), layout_helper_1 = require("./layout/layout-helper"), factory_1 = require("./core/factory"), components_1 = require("./components"), cell_type_1 = require("./scenegraph/group-creater/cell-type"), get_axis_config_1 = require("./layout/chart-helper/get-axis-config"), chart_render_helper_1 = require("./scenegraph/graphic/contributions/chart-render-helper");
|
|
8
8
|
|
|
9
9
|
(0, components_1.registerAxis)(), (0, components_1.registerEmptyTip)(), (0, components_1.registerLegend)(),
|
|
10
10
|
(0, components_1.registerMenu)(), (0, components_1.registerTitle)(), (0, components_1.registerTooltip)(),
|
|
@@ -632,6 +632,65 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
632
632
|
}
|
|
633
633
|
return {};
|
|
634
634
|
}
|
|
635
|
+
activateChartInstance(cellHeaderPaths) {
|
|
636
|
+
var _a, _b, _c, _d, _e;
|
|
637
|
+
const cellAddr = this.getCellAddressByHeaderPaths(cellHeaderPaths);
|
|
638
|
+
if (cellAddr) {
|
|
639
|
+
const col = cellAddr.col, row = cellAddr.row, cellGroup = this.scenegraph.getCell(col, row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0], activeChartInstance = this.scenegraph.activateChart(col, row), {dataId: dataId, data: data, axes: axes, spec: spec} = chartNode.attribute, viewBox = chartNode.getViewBox();
|
|
640
|
+
null == axes || axes.forEach(((axis, index) => {
|
|
641
|
+
var _a, _b, _c, _d, _e;
|
|
642
|
+
"linear" === axis.type ? activeChartInstance.updateModelSpecSync({
|
|
643
|
+
type: "axes",
|
|
644
|
+
index: index
|
|
645
|
+
}, {
|
|
646
|
+
min: null !== (_b = null === (_a = axis.range) || void 0 === _a ? void 0 : _a.min) && void 0 !== _b ? _b : 0,
|
|
647
|
+
max: null !== (_d = null === (_c = axis.range) || void 0 === _c ? void 0 : _c.max) && void 0 !== _d ? _d : 0,
|
|
648
|
+
tick: {
|
|
649
|
+
tickMode: null === (_e = axis.tick) || void 0 === _e ? void 0 : _e.tickMode
|
|
650
|
+
}
|
|
651
|
+
}, !0) : "band" === axis.type && activeChartInstance.updateModelSpec({
|
|
652
|
+
type: "axes",
|
|
653
|
+
index: index
|
|
654
|
+
}, {
|
|
655
|
+
domain: axis.domain.slice(0)
|
|
656
|
+
}, !0);
|
|
657
|
+
})), activeChartInstance.updateViewBox({
|
|
658
|
+
x1: 0,
|
|
659
|
+
x2: viewBox.x2 - viewBox.x1,
|
|
660
|
+
y1: 0,
|
|
661
|
+
y2: viewBox.y2 - viewBox.y1
|
|
662
|
+
}, !1, !1);
|
|
663
|
+
const chartStage = activeChartInstance.getStage();
|
|
664
|
+
chartStage.needRender = !0;
|
|
665
|
+
const matrix = chartNode.globalTransMatrix.clone(), stageMatrix = chartNode.stage.window.getViewBoxTransform().clone();
|
|
666
|
+
if (stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f),
|
|
667
|
+
chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f),
|
|
668
|
+
"string" == typeof dataId) activeChartInstance.updateDataSync(dataId, null != data ? data : []); else {
|
|
669
|
+
const dataBatch = [];
|
|
670
|
+
for (const dataIdStr in dataId) {
|
|
671
|
+
const dataIdAndField = dataId[dataIdStr], series = spec.series.find((item => {
|
|
672
|
+
var _a;
|
|
673
|
+
return (null === (_a = null == item ? void 0 : item.data) || void 0 === _a ? void 0 : _a.id) === dataIdStr;
|
|
674
|
+
}));
|
|
675
|
+
dataBatch.push({
|
|
676
|
+
id: dataIdStr,
|
|
677
|
+
values: dataIdAndField ? null !== (_b = null == data ? void 0 : data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _b ? _b : [] : null != data ? data : [],
|
|
678
|
+
fields: null === (_c = null == series ? void 0 : series.data) || void 0 === _c ? void 0 : _c.fields
|
|
679
|
+
}), activeChartInstance.updateFullDataSync || activeChartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_d = null == data ? void 0 : data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _d ? _d : [] : null != data ? data : []);
|
|
680
|
+
}
|
|
681
|
+
null === (_e = activeChartInstance.updateFullDataSync) || void 0 === _e || _e.call(activeChartInstance, dataBatch);
|
|
682
|
+
}
|
|
683
|
+
return activeChartInstance;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
replaceChartCacheImage(cellHeaderPaths, chartInstance) {
|
|
687
|
+
var _a;
|
|
688
|
+
const cellAddr = this.getCellAddressByHeaderPaths(cellHeaderPaths);
|
|
689
|
+
if (cellAddr) {
|
|
690
|
+
const cellGroup = this.scenegraph.getCell(cellAddr.col, cellAddr.row), chartNode = null === (_a = null == cellGroup ? void 0 : cellGroup.getChildren()) || void 0 === _a ? void 0 : _a[0];
|
|
691
|
+
(0, chart_render_helper_1.cacheStageCanvas)(chartInstance.getStage(), chartNode);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
635
694
|
_getDimensionSortArray() {
|
|
636
695
|
var _a, _b;
|
|
637
696
|
if (null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.axes) || void 0 === _b ? void 0 : _b.length) {
|