Merge pull request #4176 from dataease/pr@dev@fix_map_label

fix(地图): 标签无法显示
This commit is contained in:
fit2cloud-chenyw 2022-12-23 17:08:28 +08:00 committed by GitHub
commit 882986467e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 12 deletions

View File

@ -908,7 +908,14 @@ export const BASE_MAP = {
}, },
itemStyle: { itemStyle: {
normal: {
},
emphasis: {
label: {
show: false
}
}
} }
}, },
series: [ series: [

View File

@ -61,9 +61,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
if (customAttr.color) { if (customAttr.color) {
const colorValue = customAttr.color.value const colorValue = customAttr.color.value
isGradient = isGradientValue(colorValue) isGradient = isGradientValue(colorValue)
// chart_option.color = customAttr.color.colors
if (customAttr.color.areaBorderColor) { if (customAttr.color.areaBorderColor) {
chart_option.series[0].itemStyle.normal.borderColor = customAttr.color.areaBorderColor chart_option.geo.itemStyle.normal.borderColor = customAttr.color.areaBorderColor
} }
} }
// tooltip // tooltip
@ -94,8 +93,8 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
// label // label
if (customAttr.label) { if (customAttr.label) {
const text = customAttr.label.formatter const text = customAttr.label.formatter
chart_option.series[0].label = customAttr.label chart_option.geo.label = customAttr.label
chart_option.series[0].label.formatter = params => { chart_option.geo.label.formatter = params => {
const a = params.seriesName const a = params.seriesName
const b = params.name const b = params.name
const c = params.value ? params.value : '' const c = params.value ? params.value : ''
@ -103,13 +102,14 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
} }
chart_option.series[0].labelLine = customAttr.label.labelLine chart_option.series[0].labelLine = customAttr.label.labelLine
if (customAttr.label.bgColor) { if (customAttr.label.bgColor) {
chart_option.series[0].label.backgroundColor = customAttr.label.bgColor chart_option.geo.label.backgroundColor = customAttr.label.bgColor
} }
if (customAttr.label.showShadow) { if (customAttr.label.showShadow) {
chart_option.series[0].label.shadowBlur = 2 chart_option.geo.label.shadowBlur = 2
chart_option.series[0].label.showdowColor = customAttr.label.shadowColor chart_option.geo.label.showdowColor = customAttr.label.shadowColor
} }
chart_option.series[0].itemStyle.emphasis.label.show = customAttr.label.show chart_option.geo.itemStyle.emphasis.label.show = customAttr.label.show
delete chart_option.geo.label.formatter
} }
const valueArr = chart.data.series[seriesIndex].data const valueArr = chart.data.series[seriesIndex].data
// visualMap // visualMap
@ -231,9 +231,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode, seri
return con?.color || '#b02a02' return con?.color || '#b02a02'
} }
}, },
encode: {
tooltip: 2
},
silent: true, silent: true,
data: markData data: markData
} }

View File

@ -3186,7 +3186,7 @@ export const TYPE_CONFIGS = [
'show', 'show',
'fontSize', 'fontSize',
'color', 'color',
'formatter',
'label-bg', 'label-bg',
'label-show-shadow', 'label-show-shadow',
'label-shadow-color' 'label-shadow-color'