Echarts地图geo组件每个区域(省份或地级市县)设置渐变色的解决方案

在这里插入图片描述
官方文档内部解释的很清楚,但是在itemStyle实例中areaColor的颜色使用color可能导致阅读的错误理解,实际上同color的渐变一样,可以设置线性渐变、径向渐变和纹理填充。

itemStyle: {
                normal: {
                    areaColor: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: 'rgba(27,132,199,0.7)'
                        }, {
                            offset: 1, color: 'rgba(46,197,251,0.7)'
                        }],
                        global: false
                    },
                    borderColor: '#404a59',

                },
                emphasis: {
                    areaColor: '#003857'
                }
            }

猜你喜欢

转载自blog.csdn.net/weixin_41290949/article/details/105241237
今日推荐