Merge pull request #5564 from dataease/pr@dev@perf_map_tooltip

perf(视图): 地图提示增加隐藏空值设置#5562
This commit is contained in:
fit2cloud-chenyw 2023-06-30 12:15:31 +08:00 committed by GitHub
commit 8d3ba9aac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 1 deletions

View File

@ -935,6 +935,8 @@ export default {
password_input_error: 'Original password input error'
},
chart: {
empty_hide: 'hiden empty',
hide: 'hide',
chart_refresh_tips: 'View refresh setting takes precedence over panel refresh setting',
'1-trend': 'trend',
'2-state': 'State',

View File

@ -934,6 +934,8 @@ export default {
password_input_error: '原始密碼輸入錯誤'
},
chart: {
empty_hide: '隱藏空值',
hide: '隱藏',
chart_refresh_tips: '視圖刷新設置優先於儀表板刷新設置',
'1-trend': '趨勢',
'2-state': '狀態',

View File

@ -933,6 +933,8 @@ export default {
password_input_error: '原始密码输入错误'
},
chart: {
empty_hide: '隐藏空值',
hide: '隐藏',
chart_refresh_tips: '视图刷新设置优先于仪表板刷新设置',
'1-trend': '趋势',
'2-state': '状态',

View File

@ -72,9 +72,13 @@ export function baseMapOption(chart_option, geoJson, chart, themeStyle, curAreaC
const reg = new RegExp('\n', 'g')
const text = tooltip.formatter.replace(reg, '<br/>')
tooltip.formatter = params => {
const val = params.value
if (tooltip.emptyHide && (val === null || typeof val === 'undefined' || isNaN(val))) {
return ''
}
const a = params.seriesName
const b = params.name
const c = params.value ?? ''
const c = (val === null || typeof val === 'undefined' || isNaN(val)) ? '' : val
return text.replace(new RegExp('{a}', 'g'), a).replace(new RegExp('{b}', 'g'), b).replace(new RegExp('{c}', 'g'), c)
}
chart_option.tooltip = tooltip

View File

@ -3323,6 +3323,7 @@ export const TYPE_CONFIGS = [
],
'tooltip-selector': [
'show',
'emptyHide',
'textStyle',
'formatter'
],

View File

@ -18,6 +18,16 @@
>{{ $t('chart.show') }}</el-checkbox>
</el-form-item>
<div v-show="tooltipForm.show">
<el-form-item
v-show="showProperty('emptyHide')"
:label="$t('chart.empty_hide')"
class="form-item"
>
<el-checkbox
v-model="tooltipForm.emptyHide"
@change="changeTooltipAttr('emptyHide')"
>{{ $t('chart.hide') }}</el-checkbox>
</el-form-item>
<el-form-item
v-show="showProperty('trigger')"
:label="$t('chart.trigger_position')"