From 76523b5787d64c589f00aa1aa3df797086b829ea Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 12 Jan 2022 11:01:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/group/Group.vue | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index e7df267002..f9cb7d2c9b 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -196,9 +196,9 @@ :options="chartGroupTreeAvailable" :normalizer="normalizer" :placeholder="$t('chart.select_group')" - :noChildrenText="$t('commons.treeselect.no_children_text')" - :noOptionsText="$t('commons.treeselect.no_options_text')" - :noResultsText="$t('commons.treeselect.no_results_text')" + :no-children-text="$t('commons.treeselect.no_children_text')" + :no-options-text="$t('commons.treeselect.no_options_text')" + :no-results-text="$t('commons.treeselect.no_results_text')" /> @@ -773,6 +773,7 @@ export default { view.customFilter = JSON.stringify([]) view.drillFields = JSON.stringify([]) view.extBubble = JSON.stringify([]) + this.setChartDefaultOptions(view) const _this = this post('/chart/view/save', view).then(response => { this.closeCreateChart() @@ -788,6 +789,33 @@ export default { }) }, + setChartDefaultOptions(view) { + const type = view.type + const attr = JSON.parse(view.customAttr) + if (type.includes('pie')) { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'inner' + } + } else if (type.includes('line')) { + attr.label.position = 'top' + } else if (type.includes('treemap')) { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'middle' + } + } else { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'middle' + } + } + view.customAttr = JSON.stringify(attr) + }, + getTable(table) { this.table = JSON.parse(JSON.stringify(table)) },