From 4491c2e925250e323d356dbed043da2f8fc00ee9 Mon Sep 17 00:00:00 2001 From: wushaochuan Date: Mon, 21 Aug 2023 16:37:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=8D=E4=BA=91=E5=9B=BE=E5=AD=97?= =?UTF-8?q?=E9=97=B4=E8=B7=9D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 4 +++- frontend/src/lang/tw.js | 4 +++- frontend/src/lang/zh.js | 4 +++- frontend/src/views/chart/chart/chart.js | 3 ++- frontend/src/views/chart/chart/util.js | 3 ++- .../views/chart/chart/wordCloud/word_cloud.js | 10 +++++----- .../components/shapeAttr/SizeSelectorAntV.vue | 19 ++++++++++++++++--- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 058f07f054..8adccfdfc7 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1561,7 +1561,9 @@ export default { map_line_color_source_color: 'Starting Color', map_line_color_target_color: 'End Color', map_line_theta_offset: 'Radian', - gauge_axis_label: 'Axis Label' + gauge_axis_label: 'Axis Label', + word_size_range: 'Word Size Range', + word_spacing: 'Word Spacing' }, dataset: { scope_edit: 'Effective only when editing', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ee66998048..2f67d62d40 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1555,7 +1555,9 @@ export default { map_line_color_source_color: '起始顏色', map_line_color_target_color: '結束顏色', map_line_theta_offset: '弧度', - gauge_axis_label: '刻度標籤' + gauge_axis_label: '刻度標籤', + word_size_range: '字號區間', + word_spacing: '文字間隔' }, dataset: { scope_edit: '僅編輯時生效', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index d885907d3f..677a4242d5 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1554,7 +1554,9 @@ export default { map_line_color_source_color: '起始颜色', map_line_color_target_color: '结束颜色', map_line_theta_offset: '弧度', - gauge_axis_label: '刻度标签' + gauge_axis_label: '刻度标签', + word_size_range: '字号区间', + word_spacing: '文字间隔' }, dataset: { scope_edit: '仅编辑时生效', diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 4e965a5a17..6eb7fa837e 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -147,7 +147,8 @@ export const DEFAULT_SIZE = { mapLineAnimateDuration: 3, mapLineAnimateInterval: 1, mapLineAnimateTrailLength: 1, - wordSizeRange: [8, 32] + wordSizeRange: [8, 32], + wordSpacing: 6 } export const DEFAULT_SUSPENSION = { show: true diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index bf3043336e..bc7b285db8 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -1756,7 +1756,8 @@ export const TYPE_CONFIGS = [ 'alpha' ], 'size-selector-ant-v': [ - 'wordSizeRange' + 'wordSizeRange', + 'wordSpacing' ], 'tooltip-selector-ant-v': [ 'show', diff --git a/frontend/src/views/chart/chart/wordCloud/word_cloud.js b/frontend/src/views/chart/chart/wordCloud/word_cloud.js index 11e323f1ea..81980dbb23 100644 --- a/frontend/src/views/chart/chart/wordCloud/word_cloud.js +++ b/frontend/src/views/chart/chart/wordCloud/word_cloud.js @@ -13,12 +13,12 @@ export function baseWordCloudOptionAntV(plot, container, chart, action) { // data const data = chart.data.data // size - let wordSizeRange = [8, 32] + let wordSizeRange + let wordSpacing if (chart.customAttr) { const customAttr = JSON.parse(chart.customAttr) - if (customAttr?.size?.wordSizeRange) { - wordSizeRange = customAttr?.size?.wordSizeRange - } + wordSizeRange = customAttr?.size?.wordSizeRange ?? [8, 32] + wordSpacing = customAttr?.size?.wordSpacing ?? 6 } // options const options = { @@ -31,7 +31,7 @@ export function baseWordCloudOptionAntV(plot, container, chart, action) { fontFamily: 'Verdana', fontSize: wordSizeRange, rotation: [0, 0], - padding: 6 + padding: wordSpacing }, random: () => 0.5, appendPadding: getPadding(chart), diff --git a/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue index 2eaddac109..43eafffbe9 100644 --- a/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shapeAttr/SizeSelectorAntV.vue @@ -1368,7 +1368,7 @@ + + + @@ -1589,9 +1601,10 @@ export default { this.sizeForm.mapLineAnimateInterval = this.sizeForm.mapLineAnimateInterval !== undefined ? this.sizeForm.mapLineAnimateInterval : DEFAULT_SIZE.mapLineAnimateInterval this.sizeForm.mapLineAnimateTrailLength = this.sizeForm.mapLineAnimateTrailLength !== undefined ? this.sizeForm.mapLineAnimateTrailLength : DEFAULT_SIZE.mapLineAnimateTrailLength if (this.sizeForm.gaugeAxisLine === null || this.sizeForm.gaugeAxisLine === undefined) { - this.sizeForm.gaugeAxisLine = DEFAULT_SIZE.gaugeAxisLin + this.sizeForm.gaugeAxisLine = DEFAULT_SIZE.gaugeAxisLine } - this.sizeForm.wordSizeRange = this.sizeForm !== undefined ? this.sizeForm.wordSizeRange : DEFAULTSIZE.wordSizeRange + this.sizeForm.wordSizeRange = this.sizeForm.wordSizeRange ?? DEFAULT_SIZE.wordSizeRange + this.sizeForm.wordSpacing = this.sizeForm.wordSpacing ?? DEFAULT_SIZE.wordSpacing } } },