map-pro
v1.0.1
Published
parse it into a beautiful echarts map
Downloads
4
Readme
demo
安装
$ npm install map-pro
使用
import mapPro from 'map-pro';
let full
let border
await fetch("https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=110000_full")
.then(r => r.json())
.then(r => full = r)
await fetch("https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=110000")
.then(r => r.json())
.then(r => border = r)
const cfg = {
echarts: echarts,
width: 500,
height: 500,
geoJson: {
border: border,
full: full,
mapName: "北京市",
},
animate: {
show: true,
constantSpeed: 150,
trailLength: 0.8,
symbolSize: 4,
delay: 500,
color: "rgba(255,255,255,0.8)",
},
};
const {mapSvg, shapesList, geoUtils, cityList} = mapPro(cfg);
echarts.registerMap("北京市", {svg: mapSvg});