npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

better-echarts-maps

v0.0.3

Published

Better echarts maps.

Readme

Better ECharts Maps

更好的 ECharts 中国地图,主要有以下扩展:

  1. 所有地图的坐标都是明文,可以使用 Geojson.io 进行编辑。
  2. 对地图内超长地名进行了缩减,方便进行显示,目前最长的是新疆部分地区五个字符长度(这会造成与官方原版地图不兼容)。
  3. 对地图进行整体打包,不用再单个引用,方便通过 webpack 进行地图注册。

同时,还提供了两份新的地图和数据:

  1. china-regions 中国区域地图
  2. china-cities-coordinate 包含了 435 个全国城市坐标,官方范例只有 190 个城市坐标。

目前包含了全国的省市和地区地图两种,39个省份和直辖市地图(包含直辖市边界图)。

安装方法

npm install --save better-echarts-maps

使用方法

因为 npm package 限制,一次只能导出一个 module,所以默认导出的是所有地图, 这有可能会导致程序体积膨胀,建议配合 Webpack 2 的 Tree shaking 特性将不用的地图去掉,

目前程序导出的四种地图类型如下:

| 名称 | 说明 | | --------------------- | ----------------- | | China | 全国省份地图 | | ChinaRegions | 全国区域地图 | | ChinaProvinces | 所有单个省份地图 | | ChinaCitiesCoordinate | 全国430个城市坐标 | | all | 除了坐标以外的所有全国、和省市地图 |

所有数据都为数组结构,以全部地图(all)为例,可以通过下面命令进行注册:

var betterEChartsMap = require('better-echarts-map');
betterEChartsMap.all.forEach(map => echarts.registerMap(map[0], map[1]));

推荐使用 ES6 的 import 语法进行单个引用,例如

import { ChinaCitiesCoordinate } from 'better-echarts-map';

在 ECharts 中使用注册的新地图

地图具体参数可以参考 http://echarts.baidu.com/examples.html

地图坐标具体使用方法可以参考 http://echarts.baidu.com/demo.html#effectScatter-map

也可以参考项目的 Demo http://xuqingkuang.github.io/better-echarts-maps

所有地图的名称对照

| 地图 mapType | 地图 | | ----------------- | ---------- | | china | 全国省份地图 | | china-regions | 全国地区地图 | | anhui | 安徽省地图 | | beijing | 北京市地图 | | beijing-contour | 北京市边界图 | | chongqing | 重庆市地图 | | chongqing-contour | 重庆市边界图 | | fujian | 福建省地图 | | gansu | 甘肃省地图 | | guangdong | 广东省地图 | | guangxi | 广西省地图 | | guizhou | 贵州省地图 | | hainan | 海南省地图 | | hebei | 河北省地图 | | heilongjiang | 黑龙江省地图 | | henan | 河南省地图 | | hongkong | 香港特别行政区地图 | | hubei | 湖北省地图 | | hunan | 湖南省地图 | | jiangsu | 江苏省地图 | | jiangxi | 江西省地图 | | jilin | 吉林省地图 | | liaoning | 辽宁省地图 | | macao | 澳门特别行政区地图 | | neimenggu | 内蒙古藏族自治区地图 | | ningxia | 宁夏自治区地图 | | qinghai | 青海省地图 | | shandong | 山东省地图 | | shanghai | 上海市地图 | | shanghai-contour | 上海市边界图 | | shanxi | 山西省地图 | | shanxi2 | 陕西省地图 | | sichuan | 四川省地图 | | taiwan | 台湾省地图 | | tianjin | 天津市地图 | | tianjin-contour | 天津市边界图 | | xinjiang | 新疆维吾尔自治区地图 | | xizang | 西藏藏族自治区地图 | | yunnan | 云南省地图 | | zhejiang | 浙江省地图 |

已知问题

  1. 香港、澳门、新疆三个地区地图有问题,待后期修复了。
  2. 城市坐标有个别城市数据为空,仍需要补齐。