diff --git a/frontend/src/icons/svg/word-cloud.svg b/frontend/src/icons/svg/word-cloud.svg
new file mode 100644
index 0000000000..7b42315b37
--- /dev/null
+++ b/frontend/src/icons/svg/word-cloud.svg
@@ -0,0 +1 @@
+
diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js
index 8682b36dcc..76dc68baeb 100644
--- a/frontend/src/lang/en.js
+++ b/frontend/src/lang/en.js
@@ -946,7 +946,10 @@ export default {
table_page_size: 'Page Size',
table_page_size_unit: 'Item/Page',
result_count: 'Result',
- result_mode_all: 'ALL'
+ result_mode_all: 'ALL',
+ chart_word_cloud: 'Word Cloud',
+ drag_block_word_cloud_label: 'Word Label',
+ drag_block_word_cloud_size: 'Word Size'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js
index 47cca6524e..8548e80956 100644
--- a/frontend/src/lang/tw.js
+++ b/frontend/src/lang/tw.js
@@ -947,7 +947,10 @@ export default {
table_page_size: '分頁',
table_page_size_unit: '條/頁',
result_count: '結果展示',
- result_mode_all: '全部'
+ result_mode_all: '全部',
+ chart_word_cloud: '詞雲',
+ drag_block_word_cloud_label: '詞標簽',
+ drag_block_word_cloud_size: '詞大小'
},
dataset: {
sheet_warn: '有多個 Sheet 頁,默認抽取第一個',
diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js
index e0d5a42d6a..93c153fb9c 100644
--- a/frontend/src/lang/zh.js
+++ b/frontend/src/lang/zh.js
@@ -950,7 +950,10 @@ export default {
table_page_size: '分页',
table_page_size_unit: '条/页',
result_count: '结果展示',
- result_mode_all: '全部'
+ result_mode_all: '全部',
+ chart_word_cloud: '词云',
+ drag_block_word_cloud_label: '词标签',
+ drag_block_word_cloud_size: '词大小'
},
dataset: {
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
diff --git a/frontend/src/views/chart/chart/waterfall/waterfall.js b/frontend/src/views/chart/chart/waterfall/waterfall.js
index 4432fe6c7a..fdb3805d9d 100644
--- a/frontend/src/views/chart/chart/waterfall/waterfall.js
+++ b/frontend/src/views/chart/chart/waterfall/waterfall.js
@@ -103,5 +103,8 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) {
}
plot = new Waterfall(container, options)
+ plot.off('interval:click')
+ plot.on('interval:click', action)
+
return plot
}
diff --git a/frontend/src/views/chart/chart/wordCloud/word_cloud.js b/frontend/src/views/chart/chart/wordCloud/word_cloud.js
new file mode 100644
index 0000000000..c506e7cf8b
--- /dev/null
+++ b/frontend/src/views/chart/chart/wordCloud/word_cloud.js
@@ -0,0 +1,62 @@
+import {
+ getPadding,
+ getTheme,
+ getTooltip
+} from '@/views/chart/chart/common/common_antv'
+import { WordCloud } from '@antv/g2plot'
+
+export function baseWordCloudOptionAntV(plot, container, chart, action) {
+ // theme
+ const theme = getTheme(chart)
+ // attr
+ const tooltip = getTooltip(chart)
+ // data
+ const data = chart.data.datas
+ // options
+ const options = {
+ theme: theme,
+ data: data,
+ wordField: 'field',
+ weightField: 'value',
+ colorField: 'field',
+ wordStyle: {
+ fontFamily: 'Verdana',
+ fontSize: [8, 32],
+ rotation: [0, 0],
+ padding: 6
+ },
+ random: () => 0.5,
+ appendPadding: getPadding(chart),
+ tooltip: tooltip,
+ legend: false,
+ interactions: [
+ {
+ type: 'element-active', cfg: {
+ start: [{ trigger: 'element:mouseenter', action: ['element-highlight:highlight', 'element-active:reset', 'cursor:pointer'] }],
+ end: [{ trigger: 'element:mouseleave', action: ['element-highlight:reset', 'element-active:reset', 'cursor:default'] }]
+ }
+ }
+ ]
+ }
+ // size
+ // let customAttr = {}
+ // if (chart.customAttr) {
+ // customAttr = JSON.parse(chart.customAttr)
+ // if (customAttr.size) {
+ // const s = JSON.parse(JSON.stringify(customAttr.size))
+ // if (s.barDefault) {
+ // delete options.marginRatio
+ // } else {
+ // options.marginRatio = s.barGap
+ // }
+ // }
+ // }
+
+ // 开始渲染
+ if (plot) {
+ plot.destroy()
+ }
+ plot = new WordCloud(container, options)
+
+ return plot
+}
diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue
index 48156af50d..6e9eef6d43 100644
--- a/frontend/src/views/chart/components/ChartComponentG2.vue
+++ b/frontend/src/views/chart/components/ChartComponentG2.vue
@@ -23,6 +23,7 @@ import { baseFunnelOptionAntV } from '@/views/chart/chart/funnel/funnel_antv'
import { baseTreemapOptionAntV } from '@/views/chart/chart/treemap/treemap_antv'
import { baseRadarOptionAntV } from '@/views/chart/chart/radar/radar_antv'
import { baseWaterfallOptionAntV } from '@/views/chart/chart/waterfall/waterfall'
+import { baseWordCloudOptionAntV } from '@/views/chart/chart/wordCloud/word_cloud'
export default {
name: 'ChartComponentG2',
@@ -161,6 +162,8 @@ export default {
this.myChart = baseLiquid(this.myChart, this.chartId, chart)
} else if (chart.type === 'waterfall') {
this.myChart = baseWaterfallOptionAntV(this.myChart, this.chartId, chart, this.antVAction)
+ } else if (chart.type === 'word-cloud') {
+ this.myChart = baseWordCloudOptionAntV(this.myChart, this.chartId, chart, this.antVAction)
} else {
if (this.myChart) {
this.antVRenderStatus = false
diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue
index 8c57a5d51f..a25d6f38fc 100644
--- a/frontend/src/views/chart/view/ChartEdit.vue
+++ b/frontend/src/views/chart/view/ChartEdit.vue
@@ -176,6 +176,7 @@
{{ $t('chart.drag_block_radar_label') }}
{{ $t('chart.area') }}
{{ $t('chart.drag_block_treemap_label') }}
+ {{ $t('chart.drag_block_word_cloud_label') }}
/
{{ $t('chart.dimension') }}
{{ $t('chart.dimension_or_quota') }}
@@ -211,6 +212,7 @@
{{ $t('chart.drag_block_treemap_size') }}
{{ $t('chart.drag_block_value_axis_main') }}
{{ $t('chart.drag_block_progress') }}
+ {{ $t('chart.drag_block_word_cloud_size') }}
/
{{ $t('chart.quota') }}
@@ -334,7 +336,7 @@
{{ $t('chart.placeholder_field') }}
-
+
{{ $t('chart.drill') }}
/
@@ -381,7 +383,7 @@
-
+
diff --git a/frontend/src/views/chart/view/ChartType.vue b/frontend/src/views/chart/view/ChartType.vue
index 46170ced83..136bcb155a 100644
--- a/frontend/src/views/chart/view/ChartType.vue
+++ b/frontend/src/views/chart/view/ChartType.vue
@@ -103,13 +103,17 @@
+
+
+
+
+
-