码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-07-09 15:19:48      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:block   bsp   echart   lse   real   and   math   shu   dex   

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 中国地图,根据省份数值高低改变省份颜色深浅

标签:block   bsp   echart   lse   real   and   math   shu   dex   

原文地址:https://www.cnblogs.com/onesea/p/13273544.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!