diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 429ffa0efa..3b514a6e3e 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1173,7 +1173,16 @@ export default { conditions_can_not_empty: 'Conditions can not be empty,if unnecessary,please delete the field', remark: 'Remark', remark_edit: 'Edit Remark', - remark_bg_color: 'Background Fill' + remark_bg_color: 'Background Fill', + quota_font_family: 'Value Font Family', + quota_text_style: 'Value Style', + quota_letter_space: 'Value Letter Space', + dimension_font_family: 'Name Font Family', + dimension_text_style: 'Name Style', + dimension_letter_space: 'Name Letter Space', + font_family: 'Font Family', + letter_space: 'Letter Space', + font_shadow: 'Font Shadow' }, dataset: { parse_filed: 'Parse Field', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 82b5fa89e7..7930e9a901 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1172,7 +1172,16 @@ export default { conditions_can_not_empty: '字段的條件不能為空,若無條件,請直接刪除該字段', remark: '備註', remark_edit: '編輯備註', - remark_bg_color: '背景填充' + remark_bg_color: '背景填充', + quota_font_family: '值字體', + quota_text_style: '值樣式', + quota_letter_space: '值字間距', + dimension_font_family: '名稱字體', + dimension_text_style: '名稱樣式', + dimension_letter_space: '名稱字間距', + font_family: '字體', + letter_space: '字間距', + font_shadow: '字體陰影' }, dataset: { parse_filed: '解析字段', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 4bc67a27ac..c87094c343 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1174,7 +1174,16 @@ export default { conditions_can_not_empty: '字段的条件不能为空,若无条件,请直接删除该字段', remark: '备注', remark_edit: '编辑备注', - remark_bg_color: '背景填充' + remark_bg_color: '背景填充', + quota_font_family: '值字体', + quota_text_style: '值样式', + quota_letter_space: '值字间距', + dimension_font_family: '名称字体', + dimension_text_style: '名称样式', + dimension_letter_space: '名称字间距', + font_family: '字体', + letter_space: '字间距', + font_shadow: '字体阴影' }, dataset: { parse_filed: '解析字段', diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index afc9abf262..0d0da8969c 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -61,6 +61,16 @@ export const DEFAULT_SIZE = { spaceSplit: 10, dimensionShow: true, quotaShow: true, + quotaFontFamily: 'Microsoft YaHei', + quotaFontIsBolder: false, + quotaFontIsItalic: false, + quotaLetterSpace: 0, + quotaFontShadow: false, + dimensionFontFamily: 'Microsoft YaHei', + dimensionFontIsBolder: false, + dimensionFontIsItalic: false, + dimensionLetterSpace: 0, + dimensionFontShadow: false, scatterSymbol: 'circle', scatterSymbolSize: 20, treemapWidth: 80, @@ -147,7 +157,10 @@ export const DEFAULT_TITLE_STYLE = { isBolder: true, remarkShow: false, remark: '', - remarkBackgroundColor: '#ffffffff' + remarkBackgroundColor: '#ffffffff', + fontFamily: 'Microsoft YaHei', + letterSpace: '0', + fontShadow: false } export const DEFAULT_TITLE_STYLE_DARK = { @@ -157,7 +170,13 @@ export const DEFAULT_TITLE_STYLE_DARK = { hPosition: 'left', vPosition: 'top', isItalic: false, - isBolder: true + isBolder: true, + remarkShow: false, + remark: '', + remarkBackgroundColor: '#ffffffff', + fontFamily: 'Microsoft YaHei', + letterSpace: '0', + fontShadow: false } export const DEFAULT_LEGEND_STYLE = { @@ -968,3 +987,24 @@ export const BASE_ECHARTS_SELECT = { shadowBlur: 2 } } + +export const CHART_FONT_FAMILY = [ + { name: '微软雅黑', value: 'Microsoft YaHei' }, + { name: '宋体', value: 'SimSun' }, + { name: '黑体', value: 'SimHei' }, + { name: '楷体', value: 'KaiTi' } +] + +export const CHART_FONT_LETTER_SPACE = [ + { name: '0px', value: '0' }, + { name: '1px', value: '1' }, + { name: '2px', value: '2' }, + { name: '3px', value: '3' }, + { name: '4px', value: '4' }, + { name: '5px', value: '5' }, + { name: '6px', value: '6' }, + { name: '7px', value: '7' }, + { name: '8px', value: '8' }, + { name: '9px', value: '9' }, + { name: '10px', value: '10' } +] diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index aae1e199ff..9e46dfe09d 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -66,7 +66,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -108,7 +111,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -153,7 +159,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -175,8 +184,16 @@ export const TYPE_CONFIGS = [ ], 'size-selector-ant-v': [ 'quotaFontSize', + 'quotaFontFamily', + 'quotaFontStyle', + 'quotaLetterSpace', + 'quotaFontShadow', 'dimensionShow', 'dimensionFontSize', + 'dimensionFontFamily', + 'dimensionFontStyle', + 'dimensionLetterSpace', + 'dimensionFontShadow', 'spaceSplit' ], 'title-selector-ant-v': [ @@ -187,7 +204,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -209,8 +229,16 @@ export const TYPE_CONFIGS = [ ], 'size-selector-ant-v': [ 'quotaFontSize', + 'quotaFontFamily', + 'quotaFontStyle', + 'quotaLetterSpace', + 'quotaFontShadow', 'dimensionShow', 'dimensionFontSize', + 'dimensionFontFamily', + 'dimensionFontStyle', + 'dimensionLetterSpace', + 'dimensionFontShadow', 'spaceSplit' ], 'title-selector-ant-v': [ @@ -221,7 +249,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -261,7 +292,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -299,7 +333,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -368,7 +405,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -445,7 +485,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -522,7 +565,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -598,7 +644,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -667,7 +716,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -735,7 +787,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -811,7 +866,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -866,7 +924,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -921,7 +982,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -977,7 +1041,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -1030,7 +1097,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -1070,7 +1140,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -1138,7 +1211,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -1188,7 +1264,10 @@ export const TYPE_CONFIGS = [ 'hPosition', 'isItalic', 'isBolder', - 'remarkShow' + 'remarkShow', + 'fontFamily', + 'letterSpace', + 'fontShadow' ], 'legend-selector-ant-v': [ 'show', @@ -1295,8 +1374,16 @@ export const TYPE_CONFIGS = [ ], 'size-selector': [ 'quotaFontSize', + 'quotaFontFamily', + 'quotaFontStyle', + 'quotaLetterSpace', + 'quotaFontShadow', 'dimensionShow', 'dimensionFontSize', + 'dimensionFontFamily', + 'dimensionFontStyle', + 'dimensionLetterSpace', + 'dimensionFontShadow', 'spaceSplit' ], 'title-selector': [ @@ -1305,9 +1392,11 @@ export const TYPE_CONFIGS = [ 'fontSize', 'color', 'hPosition', - 'vPosition', 'isItalic', - 'isBolder' + 'isBolder', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, @@ -1329,8 +1418,16 @@ export const TYPE_CONFIGS = [ ], 'size-selector': [ 'quotaFontSize', + 'quotaFontFamily', + 'quotaFontStyle', + 'quotaLetterSpace', + 'quotaFontShadow', 'dimensionShow', 'dimensionFontSize', + 'dimensionFontFamily', + 'dimensionFontStyle', + 'dimensionLetterSpace', + 'dimensionFontShadow', 'spaceSplit' ], 'title-selector': [ @@ -1340,7 +1437,10 @@ export const TYPE_CONFIGS = [ 'color', 'hPosition', 'isItalic', - 'isBolder' + 'isBolder', + 'fontFamily', + 'letterSpace', + 'fontShadow' ] } }, diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue index 447faf672e..7ca0a3b0eb 100644 --- a/frontend/src/views/chart/components/ChartComponentG2.vue +++ b/frontend/src/views/chart/components/ChartComponentG2.vue @@ -4,7 +4,7 @@

{{ chart.title }}

- +
@@ -27,6 +27,7 @@ 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' import TitleRemark from '@/views/chart/view/TitleRemark' +import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' export default { name: 'ChartComponentG2', @@ -322,6 +323,10 @@ export default { this.title_class.textAlign = customStyle.text.hPosition this.title_class.fontStyle = customStyle.text.isItalic ? 'italic' : 'normal' this.title_class.fontWeight = customStyle.text.isBolder ? 'bold' : 'normal' + + this.title_class.fontFamily = customStyle.text.fontFamily ? customStyle.text.fontFamily : DEFAULT_TITLE_STYLE.fontFamily + this.title_class.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : DEFAULT_TITLE_STYLE.letterSpace) + 'px' + this.title_class.textShadow = customStyle.text.fontShadow ? '2px 2px 4px' : 'none' } if (customStyle.background) { this.title_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index 39426a84c6..23754d748e 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -4,7 +4,7 @@

{{ chart.title }}

- +
@@ -40,6 +40,7 @@ import ViewTrackBar from '@/components/canvas/components/Editor/ViewTrackBar' import { getRemark, hexColorToRGBA } from '@/views/chart/chart/util' import { baseTableInfo, baseTableNormal, baseTablePivot } from '@/views/chart/chart/table/table-info' import TitleRemark from '@/views/chart/view/TitleRemark' +import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' export default { name: 'ChartComponentS2', @@ -322,6 +323,10 @@ export default { if (this.$refs.title) { this.$refs.title.style.fontSize = customStyle.text.fontSize + 'px' } + + this.title_class.fontFamily = customStyle.text.fontFamily ? customStyle.text.fontFamily : DEFAULT_TITLE_STYLE.fontFamily + this.title_class.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : DEFAULT_TITLE_STYLE.letterSpace) + 'px' + this.title_class.textShadow = customStyle.text.fontShadow ? '2px 2px 4px' : 'none' } if (customStyle.background) { this.title_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) diff --git a/frontend/src/views/chart/components/component-style/TitleSelector.vue b/frontend/src/views/chart/components/component-style/TitleSelector.vue index e2132d11a8..e7aef998dd 100644 --- a/frontend/src/views/chart/components/component-style/TitleSelector.vue +++ b/frontend/src/views/chart/components/component-style/TitleSelector.vue @@ -16,6 +16,11 @@ @input="inputOnInput($event)" /> + + + + + @@ -42,6 +47,14 @@ {{ $t('chart.italic') }} {{ $t('chart.bolder') }} + + + + + + + {{ $t('chart.font_shadow') }} +
@@ -49,7 +62,7 @@