提交 c0be638c authored 作者: junjie's avatar junjie

feat(视图): 地图值不存在时,显示空

上级 0c748454
...@@ -13,7 +13,13 @@ export function baseMapOption(chart_option, chart) { ...@@ -13,7 +13,13 @@ export function baseMapOption(chart_option, chart) {
if (customAttr.tooltip) { if (customAttr.tooltip) {
const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip)) const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip))
const reg = new RegExp('\n', 'g') const reg = new RegExp('\n', 'g')
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>') const text = tooltip.formatter.replace(reg, '<br/>')
tooltip.formatter = function(params) {
const a = params.seriesName
const b = params.name
const c = params.value ? params.value : ''
return text.replaceAll('{a}', a).replaceAll('{b}', b).replaceAll('{c}', c)
}
chart_option.tooltip = tooltip chart_option.tooltip = tooltip
} }
} }
...@@ -22,13 +28,16 @@ export function baseMapOption(chart_option, chart) { ...@@ -22,13 +28,16 @@ export function baseMapOption(chart_option, chart) {
chart_option.title.text = chart.title chart_option.title.text = chart.title
if (chart.data.series.length > 0) { if (chart.data.series.length > 0) {
chart_option.series[0].name = chart.data.series[0].name chart_option.series[0].name = chart.data.series[0].name
// size
if (customAttr.size) {
chart_option.series[0].radius = [customAttr.size.pieInnerRadius + '%', customAttr.size.pieOuterRadius + '%']
}
// label // label
if (customAttr.label) { if (customAttr.label) {
const text = customAttr.label.formatter
chart_option.series[0].label = customAttr.label chart_option.series[0].label = customAttr.label
chart_option.series[0].label.formatter = function(params) {
const a = params.seriesName
const b = params.name
const c = params.value ? params.value : ''
return text.replaceAll('{a}', a).replaceAll('{b}', b).replaceAll('{c}', c)
}
chart_option.series[0].labelLine = customAttr.label.labelLine chart_option.series[0].labelLine = customAttr.label.labelLine
} }
// visualMap // visualMap
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论