echarts 中国地图,根据省份数值高低改变省份颜色深浅

Posted onesea

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了echarts 中国地图,根据省份数值高低改变省份颜色深浅相关的知识,希望对你有一定的参考价值。

function randomValue() {
    return Math.round(Math.random()*2000);
}

option = {
    backgroundColor:‘block‘,
    tooltip: {},
    visualMap: {
        min: 0,
        max: 2000,
        text:[‘High‘,‘Low‘],
        realtime: false,
        calculable: true,
        inRange: {
            color: [‘#e0ffff‘, ‘red‘]
        }
    },
    geo: {
        map: ‘china‘,
        roam: true,
        label: {
            normal: {
                show: true,
                textStyle: {
                    color: ‘rgba(0,0,0,0.4)‘
                }
            }
        },
        itemStyle: {
            normal:{
                borderColor: ‘rgba(0, 0, 0, 0.2)‘
            },
            emphasis:{
                areaColor: null,
                shadowOffsetX: 0,
                shadowOffsetY: 0,
                shadowBlur: 20,
                borderWidth: 0,
                shadowColor: ‘rgba(0, 0, 0, 0.5)‘
            }
        }
    },
    series : [
        {
            name: ‘浏览量‘,
            type: ‘map‘,
            roam: true,
            coordinateSystem: ‘geo‘,
            geoIndex: 0,
            // tooltip: {show: false},
            label: {
                normal: {
                    formatter: ‘{b}‘,
                    position: ‘right‘,
                    show: false
                },
                emphasis: {
                    show: true
                }
            },
            itemStyle: {
                normal: {
                    color: ‘#F06C00‘
                }
            },
            data:[
                {name: ‘北京‘, value: randomValue()},
                {name: ‘天津‘, value: randomValue()},
                {name: ‘上海‘, value: randomValue()},
                {name: ‘重庆‘, value: randomValue()},
                {name: ‘河北‘, value: randomValue()},
                {name: ‘河南‘, value: randomValue()},
                {name: ‘云南‘, value: randomValue()},
                {name: ‘辽宁‘, value: randomValue()},
                {name: ‘黑龙江‘, value: randomValue()},
                {name: ‘湖南‘, value: randomValue()},
                {name: ‘安徽‘, value: randomValue()},
                {name: ‘山东‘, value: randomValue()},
                {name: ‘新疆‘, value: randomValue()},
                {name: ‘江苏‘, value: randomValue()},
                {name: ‘浙江‘, value: randomValue()},
                {name: ‘江西‘, value: randomValue()},
                {name: ‘湖北‘, value: randomValue()},
                {name: ‘广西‘, value: randomValue()},
                {name: ‘甘肃‘, value: randomValue()},
                {name: ‘山西‘, value: randomValue()},
                {name: ‘内蒙古‘, value: randomValue()},
                {name: ‘陕西‘, value: randomValue()},
                {name: ‘吉林‘, value: randomValue()},
                {name: ‘福建‘, value: randomValue()},
                {name: ‘贵州‘, value: randomValue()},
                {name: ‘广东‘, value: randomValue()},
                {name: ‘青海‘, value: randomValue()},
                {name: ‘西藏‘, value: randomValue()},
                {name: ‘四川‘, value: randomValue()},
                {name: ‘宁夏‘, value: randomValue()},
                {name: ‘海南‘, value: randomValue()},
                {name: ‘台湾‘, value: randomValue()},
                {name: ‘香港‘, value: randomValue()},
                {name: ‘澳门‘, value: randomValue()}
            ]
        }
    ]
};

var chart=echarts.init(document.getElementById("Map"))
chart.setOption(option)
 技术图片
 

以上是关于echarts 中国地图,根据省份数值高低改变省份颜色深浅的主要内容,如果未能解决你的问题,请参考以下文章

Echarts 地图 省份的颜色自定义如何设置?

Echarts 地图 省份的颜色自定义如何设置?

数据可视化项目分布地图设计之显示省份地图

echarts的地图省份颜色自适应变化

Echarts 地图 省份的颜色自定义如何设置?

echarts3的中国地图省份名称位置都不在省份中间,位置怎么调整?