From 8707cec07569c417f99f0634982d944dcd1dbd0d Mon Sep 17 00:00:00 2001 From: junjie Date: Thu, 8 Apr 2021 13:41:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8D=97=E4=B8=81=E6=A0=BC=E5=B0=94=E7=8E=AB=E7=91=B0=E5=9B=BE?= =?UTF-8?q?=EF=BC=9Bspark=20sql=20=E8=A1=A8=E5=90=8D=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/service/chart/ChartViewService.java | 2 +- frontend/src/icons/svg/pie-rose.svg | 1 + frontend/src/lang/zh.js | 6 +++++- frontend/src/views/chart/chart/chart.js | 2 ++ frontend/src/views/chart/chart/pie/pie.js | 15 +++++++++++++++ .../src/views/chart/components/ChartComponent.vue | 4 +++- .../chart/components/shape-attr/SizeSelector.vue | 12 ++++++++++++ frontend/src/views/chart/view/ChartEdit.vue | 9 ++++++++- 8 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 frontend/src/icons/svg/pie-rose.svg diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 5ec118fd32..9d60590fcc 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -123,7 +123,7 @@ public class ChartViewService { } else if (table.getMode() == 1) {// 抽取 DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class); String tableName = dataTableInfoDTO.getTable() + "-" + table.getDataSourceId();// todo hBase table name maybe change - data = sparkCalc.getData(tableName, xAxis, yAxis, view.getId().split("-")[0]); + data = sparkCalc.getData(tableName, xAxis, yAxis, "tmp_" + view.getId().split("-")[0]); } // 图表组件可再扩展 diff --git a/frontend/src/icons/svg/pie-rose.svg b/frontend/src/icons/svg/pie-rose.svg new file mode 100644 index 0000000000..52e4ec778d --- /dev/null +++ b/frontend/src/icons/svg/pie-rose.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 22f6aeabd8..f71ea7c723 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -693,7 +693,11 @@ export default { filter_null: '为空', filter_not_null: '不为空', filter_include: '包含', - filter_not_include: '不包含' + filter_not_include: '不包含', + rose_type: '玫瑰图模式', + radius_mode: '半径', + area_mode: '面积', + rose_radius: '圆角' }, dataset: { datalist: '数据集', diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 6c77b1264c..101290218e 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -15,6 +15,8 @@ export const DEFAULT_SIZE = { lineArea: false, pieInnerRadius: 0, pieOuterRadius: 60, + pieRoseType: 'radius', + pieRoseRadius: 5, funnelWidth: 80, radarShape: 'polygon' } diff --git a/frontend/src/views/chart/chart/pie/pie.js b/frontend/src/views/chart/chart/pie/pie.js index 7ca1d77d6c..0296a75d5b 100644 --- a/frontend/src/views/chart/chart/pie/pie.js +++ b/frontend/src/views/chart/chart/pie/pie.js @@ -50,3 +50,18 @@ export function basePieOption(chart_option, chart) { return chart_option } +export function rosePieOption(chart_option, chart) { + basePieOption(chart_option, chart) + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.size) { + chart_option.series[0].roseType = customAttr.size.pieRoseType + chart_option.series[0].itemStyle = { + borderRadius: customAttr.size.pieRoseRadius + } + } + } + return chart_option +} + diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index c5fb5f40d7..aa1256cd5a 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -8,7 +8,7 @@ import { BASE_BAR, BASE_LINE, HORIZONTAL_BAR, BASE_PIE, BASE_FUNNEL, BASE_RADAR } from '../chart/chart' import { baseBarOption, stackBarOption, horizontalBarOption, horizontalStackBarOption } from '../chart/bar/bar' import { baseLineOption, stackLineOption } from '../chart/line/line' -import { basePieOption } from '../chart/pie/pie' +import { basePieOption, rosePieOption } from '../chart/pie/pie' import { baseFunnelOption } from '../chart/funnel/funnel' import { baseRadarOption } from '../chart/radar/radar' import eventBus from '@/components/canvas/utils/eventBus' @@ -73,6 +73,8 @@ export default { chart_option = stackLineOption(JSON.parse(JSON.stringify(BASE_LINE)), chart) } else if (chart.type === 'pie') { chart_option = basePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart) + } else if (chart.type === 'pie-rose') { + chart_option = rosePieOption(JSON.parse(JSON.stringify(BASE_PIE)), chart) } else if (chart.type === 'funnel') { chart_option = baseFunnelOption(JSON.parse(JSON.stringify(BASE_FUNNEL)), chart) } else if (chart.type === 'radar') { diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 7603f0373f..d6882247f4 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -57,6 +57,18 @@ + + + + + {{ $t('chart.radius_mode') }} + {{ $t('chart.area_mode') }} + + + + + + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 3d281dd1cf..f27727dafc 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -90,8 +90,15 @@
+ +
+
+ + + +
@@ -321,7 +328,7 @@ export default { const view = JSON.parse(JSON.stringify(this.view)) view.id = this.view.id view.sceneId = this.view.sceneId - view.name = this.table.name + view.name = this.view.name ? this.view.name : this.table.name view.tableId = this.view.tableId // view.xaxis.forEach(function(ele) { // if (!ele.summary || ele.summary === '') {