地图 label 文字挪位置,防止遮挡

2020-12-08  本文已影响0人  家有饿犬和聋猫
series: [{
            name: '平均分值',
            data,
            label:{
                normal:{
                    show: true, //显示省份标签
                    textStyle: {
                        color: "#fff", //省份标签字体颜色
                        fontSize: 12
                    },
                    formatter:p=>{
                        let text = p.name;
                        if(p.name === '青海'){
                            text = '{a|青海}'
                        }
                        if(p.name === '四川'){
                            text = '{a|四川}'
                        }
                        if(p.name === '湖南'){
                            text = '{a|湖南}'
                        }
                        if(p.name === '浙江'){
                            text = '{b|浙江}'
                        }
                        if(p.name === '江苏'){
                            text = '{c|江苏}'
                        }
                        if(p.name === '山西'){
                            text = '{c|山西}'
                        }
                        if(p.name === '山东'){
                            text = '{d|山东}'
                        }
                        if(p.name === '黑龙江'){
                            text = '{c|黑龙江}'
                        }
                       
                        return text;
                    },
                    rich: {
                        a: {
                            padding: [0, 30, 0,0]
                        },
                        b:{
                            padding: [0, 0, 30,0]
                        },
                        c:{
                            padding: [20, 0, 0,0]
                        },
                        d:{
                            padding: [0, 0, 0,20]
                        }

                    }
                }
            }
        }]

image.png
上一篇 下一篇

猜你喜欢

热点阅读