From 66b75928b3954e4a62500205e193f3c17d29c7ff Mon Sep 17 00:00:00 2001 From: junjie Date: Mon, 31 Jan 2022 12:07:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20S2=E6=98=8E=E7=BB=86=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 2 +- .../canvas/custom-component/UserView.vue | 18 +- .../views/chart/chart/common/common_table.js | 10 + .../src/views/chart/chart/table/table-info.js | 59 +++ .../chart/components/ChartComponentS2.vue | 362 ++++++++++++++++++ frontend/src/views/chart/view/ChartEdit.vue | 12 +- 6 files changed, 459 insertions(+), 4 deletions(-) create mode 100644 frontend/src/views/chart/chart/common/common_table.js create mode 100644 frontend/src/views/chart/chart/table/table-info.js create mode 100644 frontend/src/views/chart/components/ChartComponentS2.vue diff --git a/frontend/package.json b/frontend/package.json index 3da6eec8cd..5d9f2444c6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@antv/g2plot": "^2.3.32", - "@antv/s2": "^1.6.0", + "@antv/s2": "^1.7.0", "@riophae/vue-treeselect": "0.4.0", "@tinymce/tinymce-vue": "^3.2.8", "axios": "^0.21.1", diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 611338e0e1..d03de10662 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -37,6 +37,16 @@ @onChartClick="chartClick" @onJumpClick="jumpClick" /> + { + columns.push(ele.dataeaseName) + + meta.push({ + field: ele.dataeaseName, + name: ele.name + }) + }) + + // data config + const s2DataConfig = { + fields: { + columns: columns + }, + meta: meta, + data: tableData + } + + // options + const s2Options = { + width: containerDom.offsetWidth, + height: containerDom.offsetHeight, + // showSeriesNumber: true + style: { + cellCfg: { + width: 500 + } + } + } + + // 开始渲染 + if (s2) { + s2.destroy() + } + s2 = new TableSheet(containerDom, s2DataConfig, s2Options) + + // theme + const customTheme = getCustomTheme(chart) + s2.setThemeCfg({ theme: customTheme }) + + return s2 +} diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue new file mode 100644 index 0000000000..4421891aaf --- /dev/null +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -0,0 +1,362 @@ + + + + + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index f32461c88f..9675393638 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -769,8 +769,16 @@ class="chart-class" @onChartClick="chartClick" /> +