From cd3cbef99dfb6745db28b61190fb1b6742a9759f Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Thu, 25 Apr 2024 15:43:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=20topN=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=A1=B9=E7=9A=84=E6=A0=87=E7=AD=BE=20#9042?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/lang/en.js | 1 + core/frontend/src/lang/tw.js | 1 + core/frontend/src/lang/zh.js | 1 + core/frontend/src/views/chart/chart/chart.js | 6 ++++-- .../frontend/src/views/chart/chart/common/common.js | 9 +++++++-- .../src/views/chart/chart/common/common_antv.js | 12 ++++++++---- .../chart/components/shapeAttr/ColorSelector.vue | 13 +++++++++++++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/core/frontend/src/lang/en.js b/core/frontend/src/lang/en.js index 6a90faf5d7..9197b8111b 100644 --- a/core/frontend/src/lang/en.js +++ b/core/frontend/src/lang/en.js @@ -1236,6 +1236,7 @@ export default { top_n_desc: 'Merge data into other', top_n_input_1: 'Show Top', top_n_input_2: ',the rest merged to other', + top_n_label: 'Label of the merged', area_border_color: 'Map border', area_base_color: 'Base map', size: 'Size', diff --git a/core/frontend/src/lang/tw.js b/core/frontend/src/lang/tw.js index a6dc7998df..b2e190375b 100644 --- a/core/frontend/src/lang/tw.js +++ b/core/frontend/src/lang/tw.js @@ -1237,6 +1237,7 @@ export default { top_n_desc: '合併數據', top_n_input_1: '顯示 Top', top_n_input_2: ', 其餘合併至其他', + top_n_label: '其他項標籤', area_border_color: '地圖邊線', area_base_color: '底圖', size: '大小', diff --git a/core/frontend/src/lang/zh.js b/core/frontend/src/lang/zh.js index a935edb5e9..4b7dc05a0c 100644 --- a/core/frontend/src/lang/zh.js +++ b/core/frontend/src/lang/zh.js @@ -1233,6 +1233,7 @@ export default { top_n_desc: '合并数据', top_n_input_1: '显示 Top', top_n_input_2: ', 其余合并至其他', + top_n_label: '其他项标签', area_border_color: '地图边线', area_base_color: '底图', size: '大小', diff --git a/core/frontend/src/views/chart/chart/chart.js b/core/frontend/src/views/chart/chart/chart.js index d40c2dfc41..14a37c8766 100644 --- a/core/frontend/src/views/chart/chart/chart.js +++ b/core/frontend/src/views/chart/chart/chart.js @@ -42,7 +42,8 @@ export const DEFAULT_COLOR_CASE = { mapLineTargetColor: '#576CBC', quotaSuffixColor: '#5470c6', calcTopN: false, - topN: 5 + topN: 5, + topNLabel: '其他' } export const DEFAULT_COLOR_CASE_DARK = { @@ -69,7 +70,8 @@ export const DEFAULT_COLOR_CASE_DARK = { mapLineTargetColor: '#3795BD', quotaSuffixColor: '#5470c6', calcTopN: false, - topN: 5 + topN: 5, + topNLabel: '其他' } export const DEFAULT_SIZE = { barDefault: true, diff --git a/core/frontend/src/views/chart/chart/common/common.js b/core/frontend/src/views/chart/chart/common/common.js index f4d4340b64..c84aa3fad0 100644 --- a/core/frontend/src/views/chart/chart/common/common.js +++ b/core/frontend/src/views/chart/chart/common/common.js @@ -1,5 +1,10 @@ import { hexColorToRGBA } from '@/views/chart/chart/util' -import { DEFAULT_XAXIS_STYLE, DEFAULT_YAXIS_EXT_STYLE, DEFAULT_YAXIS_STYLE } from '@/views/chart/chart/chart' +import { + DEFAULT_COLOR_CASE, + DEFAULT_XAXIS_STYLE, + DEFAULT_YAXIS_EXT_STYLE, + DEFAULT_YAXIS_STYLE +} from '@/views/chart/chart/chart' import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter' import { $success } from '@/utils/message' import i18n from '@/lang' @@ -437,7 +442,7 @@ export const configTopN = (data, chart) => { const otherItems = data.splice(color.topN) const initOtherItem = { ...cloneDeep(data[0]), - name: i18n.t('datasource.other'), + name: color.topNLabel ?? DEFAULT_COLOR_CASE.topNLabel, value: 0 } otherItems.reduce((p, n) => { diff --git a/core/frontend/src/views/chart/chart/common/common_antv.js b/core/frontend/src/views/chart/chart/common/common_antv.js index b4a5ff778e..4f8b6900d1 100644 --- a/core/frontend/src/views/chart/chart/common/common_antv.js +++ b/core/frontend/src/views/chart/chart/common/common_antv.js @@ -1,8 +1,12 @@ import { hexColorToRGBA } from '@/views/chart/chart/util' import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter' -import { DEFAULT_XAXIS_STYLE, DEFAULT_YAXIS_EXT_STYLE, DEFAULT_YAXIS_STYLE } from '@/views/chart/chart/chart' +import { + DEFAULT_COLOR_CASE, + DEFAULT_XAXIS_STYLE, + DEFAULT_YAXIS_EXT_STYLE, + DEFAULT_YAXIS_STYLE +} from '@/views/chart/chart/chart' import { equalsAny, includesAny } from '@/utils/StringUtils' -import i18n from '@/lang' import { regressionExp, regressionPoly, @@ -1264,8 +1268,8 @@ export const configTopN = (data, chart) => { const otherItems = data.splice(color.topN) const initOtherItem = { ...data[0], - field: i18n.t('datasource.other'), - name: i18n.t('datasource.other'), + field: color.topNLabel ?? DEFAULT_COLOR_CASE.topNLabel, + name: color.topNLabel ?? DEFAULT_COLOR_CASE.topNLabel, value: 0 } otherItems.reduce((p, n) => { diff --git a/core/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue b/core/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue index 2dccb7042b..0b38d89c94 100644 --- a/core/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue +++ b/core/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue @@ -352,6 +352,18 @@ /> {{ $t('chart.top_n_input_2') }} + + +