diff --git a/document/zh-cn/user-customize-map.md b/document/zh-cn/user-customize-map.md index fd68250e..82b65b53 100644 --- a/document/zh-cn/user-customize-map.md +++ b/document/zh-cn/user-customize-map.md @@ -19,10 +19,10 @@ 下面就以广东地图为例,说明如何自行添加地图。 ### 保存地图文件 -我已经下载了广东地图的 JS 文件,文件名为 guangdong.js。将 guangdong.js 保存在项目安装目录下的 templates/js 文件夹中。Windows 下一般为 Lib/site-packages/pyecharts/templates/js +我已经下载了广东地图的 JS 文件,文件名为 guangdong.js。将 guangdong.js 保存在项目安装目录下的 templates/js 文件夹中。Windows 下一般为 Lib/site-packages/pyecharts/templates/js/echarts ### 修改代码 -打开 template/js 文件夹下的 template.html 文件,新增一行 `````` +打开 templates 文件夹下的 base.html 文件,新增一行 `````` ![customize-map-2](https://github.com/chenjiandongx/pyecharts/blob/master/images/customize-map-2.png) @@ -39,12 +39,32 @@ map.render() ``` 如果只是使用 render() 生成 .html 文件的话到这里就可以了。还想要在 jupyter notebook 上展示地图的话,还需要下面一个步骤。 -打开项目根目录下的 template.py,找到 _mapindex 变量,新增 ```"广东": "guangdong: '//oog4yfyu0.bkt.clouddn.com/guangdong'"```,格式为 ```省份中文: "省份英文: 'js 文件地址'"```,```oog4yfyu0.bkt.clouddn.com/guangdong``` 是 js 的网络地址,例如我是上传到七牛云的。注意不要加 .js 后缀,前后要用单引号。 +打开项目根目录下的 template.py,找到 _mapindex 变量,新增 ```"广东": "guangdong"```,格式为 ```省份中文: "省份英文"。 ```python _mapindex = { - "广东": "guangdong: '//oog4yfyu0.bkt.clouddn.com/guangdong'", + "广东": "guangdong", } ``` +然后查看jupyter-notebook的所有路径。下面是mac os的例子: + +``` +$ jupyter --paths +config: + /Users/jaska/.jupyter + /Users/jaska/github/data-analysis-env/bin/../etc/jupyter + /usr/local/etc/jupyter + /etc/jupyter +data: + /Users/jaska/Library/Jupyter <--- user directory + /Users/jaska/github/data-analysis-env/bin/../share/jupyter + /usr/local/share/jupyter + /usr/share/jupyter +runtime: + /Users/jaska/Library/Jupyter/runtime +``` + +你需要做的就是把guangdong.js拷贝到/Users/jaska/Library/Jupyter/nbextensions/echarts/. + 现在也能在 jupyter notebook 上展示你所属要的地图了。 \ No newline at end of file diff --git a/images/customize-map-2.png b/images/customize-map-2.png index 320f335a..90655a19 100644 Binary files a/images/customize-map-2.png and b/images/customize-map-2.png differ