china-echarts-map
v1.0.0
Published
只存在全国和省份(省级城市)的地图
Downloads
12
Readme
地图范围
只存在全国和省份(省级城市)的地图
Example
获取全国地图
const echarts = require('echarts')
const Map = require('china-echarts-map')
const areaJSON = Map.getAreaJSON()
获取省份地图
const echarts = require('echarts')
const Map = require('china-echarts-map')
// 获取东莞所在省份的地图
const code = Map.getCodeByName('东莞', 'city')
// 或 Map.getCodeByName('广东') // 获取广东省地图
const province = Map.getProvince(code)
const areaJSON = Map.getAreaJSON({type: 'province', map: province.map})
echarts.registerMap(province.map, areaJSON)
API
// 获取省市信息
getMapJSON ()
// 获取地图json, type的值为country或者province
getAreaJSON(area = {type: 'country', map: 'china'})
// 获取省份
getProvince(code)
// 获取城市
getCity(code)
// 通过中文名获取code,type的值为province或者city
getCodeByName(name = '北京', type = 'province')
// 通过拼音获取code,type的值为province或者city
getCodeByPy (pinyin = 'beijing', type = 'province')