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