首先下载地图数据,json格式,地址如下:
然后直接上代码:
var mapCode = require("./china.json");
echarts.registerMap('HK', mapCode);
var datas1 = [{name:'北京市',value:10}];
var option = {
title : {
text: '藏品区域分布情况',
x: 'center'
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
dataView: { readOnly: false },
restore: {},
saveAsImage: {}
}
},
visualMap: {
min: 0,
max: 500,
text: ['High', 'Low'],
realtime: false,
calculable: true,
inRange: {
color: ['lightskyblue', 'yellow', 'orangered']
},
left:300,
bottom:300
},
series: [{
type: 'map',
map: 'HK',
aspectScale: 1,
label: {
normal: {
show: false,
color:'white'
},
emphasis: {
show: true,
}
},
itemStyle: {
normal: {
// areaColor: '#B2CAE0',
borderColor: '#fff',
borderWidth: 1,
},
emphasis: {
// areaColor: '#FFAE00',
}
},
data: datas1
}]
};
shuzicangpinChart6.setOption(option);