🤝 Merge branch 'dev' into pyecharts-cli-replaces-jupyter-pip

This commit is contained in:
chfw 2018-01-29 08:11:03 +00:00
commit c0447bc2d7
43 changed files with 511 additions and 131 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ __pycache__/
.idea
# Distribution / packaging
.Python
test/render.html
test/*.html
env/
build/
develop-eggs/

1
CNAME Normal file
View File

@ -0,0 +1 @@
pyecharts.org

105
README.md
View File

@ -1,24 +1,28 @@
# [pyecharts](https://github.com/pyecharts/pyecharts) [![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# [pyecharts](https://github.com/pyecharts/pyecharts) [![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
> pyecharts is a library to generate charts using Echarts. It simply provides the interface between Echarts and Python.
> pyecharts is a library to generate charts using Echarts. It simply provides the interface of 28+ kinds of charts between Echarts and Python.
## Introduction
[Echarts](https://github.com/ecomfe/echarts) is an open source library from Baidu for data visualization in javascript. It has awesome demo pages so I started to look out for an interface library so that I could use it in Python. I ended up with [echarts-python](https://github.com/yufeiminds/echarts-python) on github but it lacks of documentation and was not updated for a while. Just like many other Python projects, I started my own project, pyecharts, referencing echarts-python and another library [pygal](https://github.com/Kozea/pygal).
## Installation
pyecharts works on Python2 and Python3. For more information please refer to [changelog.md](https://github.com/pyecharts/pyecharts/blob/master/changelog.md)
### Python Compatibility
### Jupyter-Notebook
Make sure you hava installed jupyter-notebook enviroment if you want to show your charts on notebook.
How to install it?
```
$ pip install notebook
pyecharts works on Python2.7 and Python3.4+.
pyecharts handles all strings and files with unicode encoding and you **MUST** use unicode string on Python 2.
```python
#coding=utf-8
from __future__ import unicode_literals
```
### pyecharts
You can install it via pip
```
$ pip install pyecharts -U
$ pip install pyecharts
```
or clone it and install it
@ -30,6 +34,9 @@ $ python setup.py install
```
## Basic Usage
### Render to Local Html File
```python
from pyecharts import Bar
@ -42,50 +49,86 @@ bar.add("evaporation", attr, v2, mark_line=["average"], mark_point=["max", "min"
bar.render()
```
It will create a file named render.html in the root directory, open file with your borwser.
It will create a file named *render.html* in the root directory, open file with your borwser.
![usage-0](https://user-images.githubusercontent.com/19553554/35104516-036181b2-fca4-11e7-8008-4ff4044245ee.gif)
![usage-0](https://user-images.githubusercontent.com/19553554/35388262-078a4afc-020e-11e8-8acc-cc7bc8a4e8a6.gif)
### Export as Images or Pdf
## Working with pandas & numpy
![pandas-numpy](https://user-images.githubusercontent.com/19553554/35104252-3e36cee2-fca3-11e7-8e43-09bbe8dbbd1e.png)
[pyecharts-snapshot](https://github.com/pyecharts/pyecharts-snapshot) is a library which renders the output of pyecharts as a png, jpeg, gif image or a pdf file at command line or in your code.
See more detail at the repositoty.
## Working with Flask & Django
Flask
## Platform Support
pyecharts exposes chart API and template API so that it can work on some common platforms.
### Work on Jupyter Notebook
In the Notebook cell ,you can simply call the instance itself to diplay the chart.
All chart classes in pyecharts implement the `_repr_html_` interface about [IPython Rich Display](http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display) .
In the case of online jshost mode,you can also download as some file formats (ipynb/py/html/pdf) and run without jupyter notebook enviromnment.
![pandas_numpy](https://user-images.githubusercontent.com/19553554/35104252-3e36cee2-fca3-11e7-8e43-09bbe8dbbd1e.png)
### Integrate With Web Framework
With the help of pyecharts API,it is easy to integrate pyecharts to your web projects, such as Flask and Django.
Demo
![flask-0](https://user-images.githubusercontent.com/19553554/35081158-3faa7c34-fc4d-11e7-80c9-2de79371374f.gif)
Django
## Advance Topics
![django-0](https://user-images.githubusercontent.com/19553554/35081440-21efcf58-fc4f-11e7-8427-ed73306533e8.gif)
### Cusom Template FIles and Layout
* 中文文档
* [pyecharts + Flask](https://github.com/pyecharts/pyecharts/blob/master/docs/zh-cn/doc_flask.md)
* [pyecharts + Django](https://github.com/pyecharts/pyecharts/blob/master/docs/zh-cn/doc_django.md)
* English
* [pyecharts + Flask](https://github.com/pyecharts/pyecharts/blob/master/docs/en-us/doc_flask.md)
* [pyecharts + Django](https://github.com/pyecharts/pyecharts/blob/master/docs/en-us/doc_django.md)
pyecharts exposes engine API so that you can use your own template file and integrate with CSS framework.
In addition,pyecharts also ships a lot of jinja2 template functions used in template files.
### Custom Map Library
All map is hosted by the repository [echarts-china-cities-js](https://github.com/pyecharts/echarts-china-cities-js) and [echarts-countries-js](https://github.com/pyecharts/echarts-countries-js) .
## Documentation
* [中文文档](https://github.com/pyecharts/pyecharts/tree/master/docs/zh-cn)
* [English](https://github.com/pyecharts/pyecharts/tree/master/docs/en-us)
* [中文文档](http://pyecharts.org/#/zh-cn/)
* [English Documentation](http://pyecharts.org/#/en-us/)
## Examples
All examples is hosted on the repository [pyecharts-users-cases](https://github.com/pyecharts/pyecharts-users-cases) .
## Test
If you work on Python2.7, please install `mock` library manually.
### Unit Test
Run as the following commands.
You should install the libraries in the requirements.txt files.
```shell
$ cd test
$ nosetests --with-coverage --cover-package pyecharts --cover-package test
```
pip install -r test\requirements.txt
```
And run with the [nose](https://nose.readthedocs.io/en/latest/) commands.
```shell
$ make
```
### Quality Assurance
[flake8](http://flake8.pycqa.org/en/latest/index.html) and [pylint](https://www.pylint.org/) are used to improve the quality of code.
### Continuous Integration
The project is developed with [Travis CI](https://travis-ci.org/) .
## Author
pyecharts is developed and maintained by chenjiandongx ([chenjiandongx@qq.com](chenjiandongx@qq.com))
[![chenjiandongx](https://user-images.githubusercontent.com/19553554/35315207-02ea37ea-0106-11e8-9f9f-8fb26922c492.png)](https://github.com/chenjiandongx) [![chfw](https://user-images.githubusercontent.com/19553554/35315208-032a38a4-0106-11e8-85f1-7f601330027f.png)](https://github.com/chfw) [![kinegratii](https://user-images.githubusercontent.com/19553554/35315209-0368f8fa-0106-11e8-99f6-c71d7624a2c9.png)](https://github.com/kinegratii)
## License
pyecharts is released under the MIT License. See LICENSE for more information.

View File

@ -1 +1,26 @@
# TODO
# pyecharts 文档
[![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开源的一个数据可视化 JS 库。用 Echarts 生成的图可视化效果非常棒pyecharts 是为了与 Python 进行对接,方便在 Python 中直接使用数据生成图。
**基本使用**
[渲染图表](zh-cn/prepare) | [图表配置](zh-cn/charts)
**高级话题**
[图表 API](zh-cn/api) | [自定义地图](zh-cn/customize_map)
**平台支持**
[Jupyter Notebook](zh-cn/jupyter_notebook) | [Flask](zh-cn/flask) | [Django](zh-cn/django) | [web 框架整合](zh-cn/web_integration)
**其他资源**
[示例项目](https://github.com/pyecharts/pyecharts-users-cases) | [地图扩展项目](https://github.com/pyecharts/echarts-china-cities-js)
**项目开发**
[版本日志](zh-cn/changelog) | [发布日志](zh-cn/release-note/) | [开发团队](zh-cn/team) | [赞助者名单](zh-cn/donors) | [FAQ](zh-cn/faq)

View File

@ -2,9 +2,11 @@
# pyecharts
> pyecharts is a Python Echarts Plotting Library.
> A Python Echarts Plotting Library.
It simply provides the interface between Echarts and Python.
* Chart: 28+ kinds of charts
* Map: 300+ Chinese cities / 200+ countries and regions
* Platforms: Pure Python / Jupyter Notebook / Web Framework
[GitHub](https://github.com/pyecharts/pyecharts/)

View File

@ -1,5 +1,26 @@
# [pyecharts](https://github.com/chenjiandongx/pyecharts)
[![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# pyecharts Document
[![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[Echarts](https://github.com/ecomfe/echarts) is an open source library from Baidu for data visualization in javascript. It has awesome demo pages so I started to look out for an interface library so that I could use it in Python. I ended up with [echarts-python](https://github.com/yufeiminds/echarts-python) on github but it lacks of documentation and was not updated for a while. Just like many other Python projects, I started my own project, pyecharts, referencing echarts-python and another library [pygal](https://github.com/Kozea/pygal).
[Echarts](https://github.com/ecomfe/echarts) is an open source library from Baidu for data visualization in javascript. It has awesome demo pages so I started to look out for an interface library so that I could use it in Python. I ended up with [echarts-python](https://github.com/yufeiminds/echarts-python) on github but it lacks of documentation and was not updated for a while. Just like many other Python projects, I started my own project, pyecharts, referencing echarts-python and another library [pygal](https://github.com/Kozea/pygal).
**Basic Usage**
[Chart Render](en-us/prepare) | [Chart Options](en-us/charts)
**Advance Topics**
[Chart API](en-us/api) | [Custom Map](en-us/customize_map)
**Platform Support**
[Jupyter Notebook](en-us/jupyter_notebook) | [Flask](en-us/flask) | [Django](en-us/django) | [Web Integration](en-us/web_integration)
**Other Resources**
[Demo Projects](https://github.com/pyecharts/pyecharts-users-cases) | [Map Extension](https://github.com/pyecharts/echarts-china-cities-js)
**Development**
[Changelog](en-us/changelog) | [Release Note](en-us/release-note) | [Team](en-us/team) | [FAQ](en-us/faq)

View File

@ -1,5 +1,7 @@
- [Charts](en-us/doc_charts)
- [pyecharts+Flask](en-us/doc_flask)
- [pyecharts+Django](en-us/doc_django)
- [Web integration](en-us/doc_web_integration)
- [API](en-us/doc_api)
- [Charts](en-us/charts)
- [pyecharts+Flask](en-us/flask)
- [pyecharts+Django](en-us/django)
- [pyecharts+Flask](en-us/flask)
- [pyecharts+Django](en-us/django)
- [Web integration](en-us/web_integration)
- [API](en-us/api)

View File

@ -83,7 +83,11 @@ Data type:dict.The config options for a chart。Each chart has its own format an
**js_dependencies**
Data type:set.The js filename collections for a chart's dependencies.Every element do not contain the filename extension(.js).E.g `{'echarts.min', 'fujian'}` .
*Changed in v0.4*
Data type:list.The js filename collections for a chart's dependencies.Every element do not contain the filename extension(.js).E.g `{'echarts.min', 'fujian'}` .
> In previous v0.4, the js_dependencies returns a unordered set.
### Methods
@ -245,8 +249,8 @@ Which mode is used is determined by the `PyEchartsConfig.jshost` and `PyEcharts
| ---------------------------------------- | ------------ | ----------- | ------------------------- | --------------------- |
| `/template/js/echarts` | local | IE | Generate one file locally | Default value |
| `'https://chfw.github.io/jupyter-echarts/echarts'` | remote | IE | Generate on file | switch using `online` |
| 其他本地模式 (如 `/static/js`) | local | EI | Integrate with Web | |
| 其他远程模式(如 `hthttps://cdn.bootcss.com/echarts/3.7.2` | remote | EI | Use remote JS | |
| Other Local Host (E.g. `/static/js`) | local | EL | Integrate with Web | |
| Other Remote Host(E.g. `hthttps://cdn.bootcss.com/echarts/3.7.2`) | remote | EL | Use remote JS | |
Example

View File

@ -0,0 +1,63 @@
# pyecharts Document - Jupyter Notebook
## Overview
You can show charts and export to some file formats in the Jupyter Notebook.
## Installation
When install the *pyecharts* package using the following command, a jupyter nbextension named *echarts/main* will be installed if jupyter exists.Or the nbextension installation will be skipped.
```shell
pip install pyecharts
```
In the development, you can also use the command to install manually jupyter nbextension.
```shell
$ git clone https://github.com/pyecharts/jupyter-echarts.git
$ cd jupyter-echarts
$ jupyter nbextension install echarts --user
```
You can check the jupyter nbextension using the *list* command.
```shell
$ jupyter nbextension list
Known nbextensions:
config dir: /Users/jaska/.jupyter/nbconfig
notebook section
echarts/main enabled
- Validating: OK
```
## Show Charts
In the Notebook cell ,you can simply call the instance itself to diplay the chart.
All chart classes in pyecharts implement the `_repr_html_` interface about [IPython Rich Display](http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display) .
![pandas_numpy](https://github.com/pyecharts/pyecharts/blob/master/images/pandas-numpy.png)
## Export Images and Pdf
You can also download as some file formats (ipynb/py/html/pdf) and run without jupyter notebook enviromnment.
**Important** You must be use remote jshost mode to enable this feature.
```python
from pyecharts import online
online(host='https://my-site.com')
```
## Demo
see more detail for [pyecharts-users-cases](https://github.com/pyecharts/pyecharts-users-cases) 。
## jupyterlab
[jupyterlab](https://github.com/jupyterlab/jupyterlab) is the next generation for Jupyter Notebook,and this is a very early preview, and is not suitable for general usage yet. We will pay Continuous attention to the development and make adapter with pyecharts.

27
docs/en-us/team.md Normal file
View File

@ -0,0 +1,27 @@
# Author
## Development Team
Home Url: https://github.com/pyecharts
| Avatar | Username | Role |
| ------ | ------ | ------ |
| ![chenjiandongx](https://avatars3.githubusercontent.com/u/19553554?s=60&v=4) | [chenjiandongx](https://github.com/chenjiandongx) | Owner |
| <img src="https://avatars2.githubusercontent.com/u/4280312?s=60&v=4" width="60px"/> |[chfw](https://github.com/chfw) | Member |
| ![kinegratii](https://avatars2.githubusercontent.com/u/9875406?s=60&v=4) | [kinegratii](https://github.com/kinegratii) | Member |
## Contributors
> Thank you for contributions
| Avatar | Username |
| ------ | ------ |
| <img src="https://avatars2.githubusercontent.com/u/7701324?s=60&v=4" alt="landpack" width="60px"/> | [landpack](https://github.com/landpack) |
| <img src="https://avatars0.githubusercontent.com/u/5152516?s=60&v=4" alt="muxuezi" width="60px"/> | [muxuezi](https://github.com/muxuezi) |
| <img src="https://avatars1.githubusercontent.com/u/15723603?s=60&v=4" alt="647-coder" width="60px"/> | [647-coder](https://github.com/647-coder) |
| <img src="https://avatars0.githubusercontent.com/u/3361029?s=60&v=4" alt="sd8089730" width="60px"/> | [sd8089730](https://github.com/sd8089730) |
| <img src="https://avatars0.githubusercontent.com/u/30370926?s=60&v=4" alt="MiracleXYZ" width="60px"/> | [MiracleXYZ](https://github.com/MiracleXYZ) |
| <img src="https://avatars0.githubusercontent.com/u/17876968?s=60&v=4" alt="mowujilun" width="60px"/> | [mowujilun](https://github.com/mowujilun) |
| <img src="https://avatars1.githubusercontent.com/u/30023826?s=60&v=4" alt="xbanke" width="60px"/> | [xbanke](https://github.com/xbanke) |
| <img src="https://avatars2.githubusercontent.com/u/15907728?s=60&v=4" alt="shkey" width="60px"/> | [shkey](https://github.com/shkey) |
| <img src="https://avatars1.githubusercontent.com/u/1425636?s=60&v=4" alt="crispgm" width="60px"/> | [crispgm](https://github.com/crispgm) |

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -8,14 +8,14 @@
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="icon" href="favicon.ico">
</head>
<body>
<nav>
<a href="#/">Home</a>
<a href="#/">主页</a>
<a href="#/zh-cn/">中文</a>
<a href="#/en-us/">EN</a>
<a href="#/release-note/">release</a>
<a href="#/en-us/">English</a>
</nav>
<div id="app"></div>
<script>
@ -29,9 +29,7 @@
auto2top: true,
search: {
maxAge: 86400000,
paths: ['/zh-cn/', '/en-us/', '/release-note/'],
placeholder: {
'/': '全文搜索',
'/zh-cn/': '全文搜索',
'/release-note/': '全文搜索',
'/en-us/': 'Search',

View File

@ -1 +0,0 @@
# TODO

View File

@ -1,2 +0,0 @@
- [changelog](release-note/changelog)
- [v0.3.0](release-note/v030)

View File

@ -1,5 +1,26 @@
# [pyecharts](https://github.com/chenjiandongx/pyecharts)
[![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
# pyecharts 文档
[![Build Status](https://travis-ci.org/pyecharts/pyecharts.svg?branch=master)](https://travis-ci.org/pyecharts/pyecharts) [![codecov](https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg)](https://codecov.io/gh/pyecharts/pyecharts) [![PyPI version](https://badge.fury.io/py/pyecharts.svg)](https://badge.fury.io/py/pyecharts) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开源的一个数据可视化 JS 库。用 Echarts 生成的图可视化效果非常棒,为了与 Python 进行对接,方便在 Python 中直接使用数据生成图,我写了这个项目。
pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开源的一个数据可视化 JS 库。用 Echarts 生成的图可视化效果非常棒pyecharts 是为了与 Python 进行对接,方便在 Python 中直接使用数据生成图。
**基本使用**
[渲染图表](zh-cn/prepare) | [图表配置](zh-cn/charts)
**高级话题**
[图表 API](zh-cn/api) | [自定义地图](zh-cn/customize_map)
**平台支持**
[Jupyter Notebook](zh-cn/jupyter_notebook) | [Flask](zh-cn/flask) | [Django](zh-cn/django) | [web 框架整合](zh-cn/web_integration)
**其他资源**
[示例项目](https://github.com/pyecharts/pyecharts-users-cases) | [地图扩展项目](https://github.com/pyecharts/echarts-china-cities-js)
**项目开发**
[版本日志](zh-cn/changelog) | [发布日志](zh-cn/release-note/) | [开发团队](zh-cn/team) | [FAQ](zh-cn/faq)

View File

@ -1,9 +1,9 @@
- [快速开始](zh-cn/doc_prepare)
- [图表详情](zh-cn/doc_charts)
- [地图自定义](zh-cn/doc_customize_map)
- [画廊](zh-cn/doc_gallery)
- [pyecharts+Flask](zh-cn/doc_flask)
- [pyecharts+Django](zh-cn/doc_django)
- [Web整合](zh-cn/doc_web_integration)
- [API](zh-cn/doc_api)
- [FAQ](zh-cn/doc_faq)
- [快速开始](zh-cn/prepare)
- [图表详情](zh-cn/charts)
- [地图自定义](zh-cn/customize_map)
- [pyecharts+Flask](zh-cn/flask)
- [pyecharts+Django](zh-cn/django)
- [Web 整合](zh-cn/web_integration)
- [艺术展](zh-cn/gallery)
- [API](zh-cn/api)
- [FAQ](zh-cn/faq)

View File

@ -39,24 +39,10 @@ js 文件仓库路径。可以设置本地或者远程地址。所有的远程
也可以使用 `pyecharts.online()` 函数设置此选项。
为了保持兼容性, jshost 并不是必须使用 '/' 等分隔符作为结尾。
注意的是,在 Jupyter Notebook 环境中,当使用
**force_js_embed**
是否强制采用内部嵌入方式渲染js文件标签 `echarts_js_dependencies` 模板函数受此影响,具体可参考该函数。
### 配置方法
`PyEchartsConfig` 拥有一些在实际运行过程中访问配置的方法。
**get_current_jshost_for_script**
获取纯 Python 环境下 jshost 的值。
**get_current_jshost_for_jupyter**
获取 Jupyter Notebook 环境中 jshost 的值。当 jshost 没有设置或者为本地路径时,返回路径将替换为 Jupyter Notebook nbextension 中的路径。
## 图表类
图表类是 pyecharts 库中最为核心的内容,每一个类代表了 [Echarts](http://echarts.baidu.com/) 中一个图表类型。下表显示了这些图表的继承体系。
@ -81,11 +67,13 @@ js 文件仓库路径。可以设置本地或者远程地址。所有的远程
**width**
数字类型(number)或字符串(str)。图表容器 div 的宽度,以 px 为单位。
数字类型(number)或字符串(str)。图表容器 div 的宽度,接收一个有效 css 长度形式的字符串;如果是数字,以 px 为单位。
**height**
数字类型(number)或字符串(str)。图表容器 div 的高度,以 px 为单位。
数字类型(number)或字符串(str)。图表容器 div 的高度,接收一个有效 css 长度形式的字符串;如果是数字,以 px 为单位。
> chart_id、width、height 三个属性均支持可写。
**options**
@ -93,9 +81,9 @@ js 文件仓库路径。可以设置本地或者远程地址。所有的远程
**js_dependencies**
集合类型(set)js 依赖文件名称列表,元素不包含文件后缀(.js),如 `{'echarts.min', 'fujian'}`
列表类型(list)js 依赖文件名称列表,元素不包含文件后缀(.js),如 `{'echarts.min', 'fujian'}`
> 从v0.4开始pyecharts 重写了 `js_dependencies` 的生成逻辑,目前返回的是有序、元素唯一的列表对象。另外还可以通过 `pyecharts.utils.merge_js_dependencies` 函数合并若干个图表的 js 依赖文件。
### 方法
@ -259,9 +247,9 @@ pyecharts 内置的引擎提供了一些模板函数,这些函数通常接收
| 取值 | 本地/远程 | script 模式 | 使用场景 | 备注 |
| ---------------------------------------- | ----- | ---------------------- | ------------- | ------------------ |
| `/template/js/echarts` | 本地 | 内嵌 | 本地生成单一文件,直接移植 | 此为默认是设置 |
| `'https://chfw.github.io/jupyter-echarts/echarts'` | 远程 | 内嵌 | 生成单一文件 | 使用 `online` 可切换到此项 |
| `'https://pyecharts.github.io/jupyter-echarts/echarts'` | 远程 | 内嵌 | 生成单一文件 | 使用 `online` 可切换到此项 |
| 其他本地模式 (如 `/static/js`) | 本地 | 外链可以通过force_embed改成内嵌 | 可用于web框架整合 | |
| 其他远程模式(如 `hthttps://cdn.bootcss.com/echarts/3.7.2` | 远程 | 外链 | | 使用外部js需依赖网络 |
| 其他远程模式(如 `hthttps://cdn.bootcss.com/echarts/3.7.2` | 远程 | 外链 | 使用外部js需依赖网络 | |
例子

View File

@ -1,19 +1,18 @@
# version log
# 版本日志
* ### version 0.4.0 (development)
* ### version 0.4.0 (echarts-3-8-5 branch)
#### Updated
* 更新 jupyter-echarts 至 1.4.0: echarts 3.6.2 -> 3.8.5, echarts-gl 1.0.0-b4 -> 1.0.0-b6, echarts-liquidfill 1.0.5 -> 1.1.1, echarts-wordcloud 1.1.0 -> 1.1.2
* ### version 0.3.2dev
#### Updated
* 更新 jupyter-echarts 至 1.3.6: [台湾地图补了市,县,岛](https://github.com/pyecharts/pyecharts/pull/316), [重庆地图补了开州区](https://github.com/pyecharts/pyecharts/pull/317)
* 地图更新:[台湾地图补了市,县,岛](https://github.com/pyecharts/pyecharts/pull/316), [重庆地图补了开州区](https://github.com/pyecharts/pyecharts/pull/317)
* 示例移到新的代码仓库 [pyecharts-users-cases](https://github.com/pyecharts/pyecharts-users-cases)
* 优化图表API图表 js_dependencies 属性返回有序列表
* 图表 chart_id 支持可设置
* 优化部分代码逻辑
#### Fixed
* [issue#322](https://github.com/pyecharts/pyecharts/issues/322) 修复在 timeline 中不能设置多个 legend 的 bug
* ### version 0.3.1 - 2017.12.13Current

View File

@ -3561,7 +3561,7 @@ style = Style(
width=1100,
height=600,
background_color='#404a59'
}
)
# style,init_style 会返回类初始化的风格配置字典
geo = Geo("全国主要城市空气质量", "data from pm2.5", **style.init_style)
```
@ -3575,7 +3575,7 @@ pie_style = style.add(
label_pos="center",
is_label_show=True,
label_text_color=None
}
)
pie.add("", ["剧情", ""], [25, 75], center=[10, 30], **pie_style)
pie.add("", ["奇幻", ""], [24, 76], center=[30, 30], **pie_style)
pie.add("", ["爱情", ""], [14, 86], center=[50, 30], **pie_style)
@ -3587,4 +3587,4 @@ pie.add("", ["惊悚", ""], [11, 89], center=[70, 30], **pie_style)
* 欢迎提交 ISSUE 和 PR
* 如有想单独讨论的话可以使用邮箱 -> chenjiandongx@qq.com
* 关注 [changelog.md](https://github.com/pyecharts/pyecharts/blob/master/changelog.md)
* 关注 [changelog.md](https://github.com/pyecharts/pyecharts/blob/master/changelog.md)

View File

@ -1,21 +0,0 @@
> FAQ 篇:本文档主要介绍一些常见问题及解决方案
### Q:克隆项目到本地后 template/js 文件夹为空,没有 js 文件?
A: 请按照 README.md 中介绍的,使用 `git clone --recursive https://github.com/chenjiandongx/pyecharts.git`。因为 template/js 实际上是一个 git submodule不递归克隆的话会遗漏该模块的内容。
### Q:pyecharts 是否支持 jupyterlab?
A: 暂不支持。 jupyterlab应该是下一代 jupyter notebook 的雏形。欢迎大家提交相关 PR。
### Q:怎么设置 echarts 主题?
A: 主题功能暂时不支持。
### Q:如何设置 tooltip 的 formatter 选项为回调函数?
A: 目前暂时无法支持。因为暂无法将 python 函数通过 json 转换对应的 js 函数。
### Q:为什么安装后还是无法 import Bar,Line 等图形
A:请检查是否将测试文件命名为 pyecharts.py如若是请重命名该文件。

36
docs/zh-cn/donors.md Normal file
View File

@ -0,0 +1,36 @@
## 赞助者名单
> 感谢大家对 pyecharts 项目的慷慨捐赠!下面是名单,排名不分先后!
* https://github.com/liuhui9312
* https://github.com/sssdjj
* https://github.com/rubinliudongpo
* https://github.com/xixihhhhh
* https://github.com/levylll
* https://github.com/AlexanderLiuzm
* https://github.com/ywq111
* https://github.com/jihu9
* https://github.com/zhangyudong0215
* https://github.com/terrylim1986
* https://github.com/Zurzark
* https://github.com/sunhailin-Leo
* https://github.com/pythoninessence
* https://github.com/yueguangguang
* https://github.com/rovedream
* https://github.com/dhlic
* https://github.com/hust100
* https://github.com/babybear1992
* https://github.com/giserpan
* https://github.com/Andor-Z
* https://github.com/virgilliu
* https://github.com/VencentCheung
* https://github.com/zhangyi7456
* https://github.com/Kunwuwu
* https://github.com/landidu
* https://github.com/tonychenxinyue
* https://github.com/danyubaoqi
* https://github.com/Rayww
* https://github.com/Koooooo-7
* https://github.com/morgengu
* https://github.com/cmcc11

64
docs/zh-cn/faq.md Normal file
View File

@ -0,0 +1,64 @@
> FAQ 篇:本文档主要介绍一些常见问题及解决方案
**Q:jupyter 绘画大量图后,图表无法显示,并提示 temporarily stop sending output **
A:jupyter-notebook console output 具体提示信息如下:
```
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
```
根据以上的提示,需要修改找到配置文件(通常为 jupyter_notebook_config.py并修改 iopub_data_rate_limit 为更大的数值。
```
## (bytes/sec) Maximum rate at which messages can be sent on iopub before they
# are limited.
c.NotebookApp.iopub_data_rate_limit = 10000000
```
**Q:在 Jupyter Notebook 使用 download-as 导出 ipynb/png/pdf 等文件后,图表无法显示?**
A:由于使用 download-as 后,便脱离了 Jupyter Notebook 的环境,无法引用其内的相关 js 文件,因此应当使用在线模式,引用来自 [jupyter-echarts](https://github.com/pyecharts/jupyter-echarts) 或其他有效的远程 js 库。
```python
from pyecharts import online
online()
```
**Q:克隆项目到本地后 template/js 文件夹为空,没有 js 文件?**
A: pyecharts 项目使用了 submodule 特性template/js 引用了另一个仓库的代码。
这时应当使用下面的命令更新 submodule 模块内容。
```
git submodule update
```
或者删除原有代码后,使用 `git clone --recursive https://github.com/pyecharts/pyecharts.git` 重新克隆代码。
**Q:pyecharts 是否支持 jupyterlab?**
A: 暂不支持。 jupyterlab 应该是下一代 jupyter notebook 的雏形。欢迎大家提交相关 PR。
**Q:怎么设置 echarts 主题?**
A: 主题功能暂时不支持。
**Q:如何设置 tooltip 的 formatter 选项为回调函数?**
A: 目前暂时无法支持。因为暂无法将 python 函数通过 json 转换对应的 js 函数。
**Q:为什么安装后还是无法 import Bar,Line 等图形**
A:请检查是否将测试文件命名为 pyecharts.py如若是请重命名该文件。
**Q:使用 pyinstaller 的单文件模式打包后无法加载 js 等静态文件?**
A:目前 pyecharts 暂时未开放这部分的API没有考虑到打包后的资源文件路径的兼容问题。建议使用文件夹/多文件模式。
如果确实需要使用单文件模式,可参考 [《Python打包工具》](https://kinegratii.github.io/2016/04/23/python-package/) 这篇文章了解相关原理后进行源码修改。

View File

@ -15,6 +15,7 @@ polar.render()
```
![example-0](https://user-images.githubusercontent.com/19553554/35080754-8a01a508-fc4a-11e7-8be4-5da46e27103d.png)
用极坐标系画出一朵小花
```python
import math
@ -43,8 +44,8 @@ for i in range(361):
r = math.sin(2 * t) * math.cos(2 * t)
data.append([r, i])
polar = Polar("极坐标系示例", width=1200, height=600)
polar.add("Color-Flower", data, start_angle=0, symbol=None, axis_range=[0, None],
area_color="#f71f24", area_opacity=0.6)
polar.add("Color-Flower", data, start_angle=0, symbol=None,
axis_range=[0, None], area_color="#f71f24", area_opacity=0.6)
polar.render()
```
![example-2](https://user-images.githubusercontent.com/19553554/35080790-c61a8ac8-fc4a-11e7-9a47-8e352b944358.png)
@ -99,9 +100,9 @@ for i in range(5):
r = math.pow(math.e, 0.003 * alpha)
data.append([r, theta])
polar = Polar("极坐标系示例")
polar.add("", data, symbol_size=0, symbol='circle', start_angle=-25, is_radiusaxis_show=False,
area_color="#f3c5b3", area_opacity=0.5, is_angleaxis_show=False)
polar.add("", data, symbol_size=0, symbol='circle', start_angle=-25,
is_radiusaxis_show=False, area_color="#f3c5b3",
area_opacity=0.5, is_angleaxis_show=False)
polar.render()
```
![example-6](https://user-images.githubusercontent.com/19553554/35080856-3cc8eaf2-fc4b-11e7-8ba8-5fdc9e3c64e8.png)

View File

@ -0,0 +1,61 @@
# pyecharts 文档 - Jupyter Notebook
## 概述
pyecharts 支持在 Jupyter Notebook 环境中显示渲染图表以及导出其他形式的文件。
## 安装
在使用以下的命令安装 pyecharts ,如果系统检查有 Jupyter Notebook 环境,将默认的 echarts.min 等文件自动安装到 Jupyter notebook 插件/扩展;否则将跳过这一步骤。
```shell
pip install pyecharts
```
在之后的开发中也可以使用下列的命令自行安装。
```shell
$ git clone https://github.com/pyecharts/jupyter-echarts.git
$ cd jupyter-echarts
$ jupyter nbextension install echarts --user
```
无论使用何种方式,均可通过以下的命令测试是否安装成功。
```shell
$ jupyter nbextension list
Known nbextensions:
config dir: /Users/jaska/.jupyter/nbconfig
notebook section
echarts/main enabled
- Validating: OK
```
## 显示图表
在 Cell 中,可以直接调用实例本身实例来显示图表,目前所有的类已经实现了 [IPython Rich Display](http://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display) 的 `_repr_html_` 方法。
![pandas-numpy](https://user-images.githubusercontent.com/19553554/35104252-3e36cee2-fca3-11e7-8e43-09bbe8dbbd1e.png)
## 导出功能
可以使用 Notebook 默认的 "download as" 导出其他形式的文件,比如 ipynb或者图片。
**重要** :由于导出后的文件脱离了原有 Jupyter Notebook 环境,为了能够完整的显示图表,应当使用远程 jshost 库。
```python
from pyecharts import online
online(host='https://my-site.com')
```
## 示例
参见 [pyecharts示例](https://github.com/pyecharts/pyecharts-users-cases) 。
## jupyterlab
[jupyterlab](https://github.com/jupyterlab/jupyterlab) 是下一代 Jupyter Notebook ,目前尚处于发展的雏形之中。我们将进一步关注项目发展,尽可能第一时间实现 pyecharts 的适配,敬请期待。

View File

@ -94,7 +94,7 @@ online()
...
```
这样,所有的脚本会从 http://pyecharts.github.io/jupyter-echarts/echarts 下载。如果你连不上 Github, 你可以先把 https://github.com/pyecharts/jupyter-echarts 克隆一下。然后在你自己的服务器上,把整个 echarts 挂上去。
这样,所有的脚本会从 https://pyecharts.github.io/jupyter-echarts/echarts 下载。如果你连不上 Github, 你可以先把 https://github.com/pyecharts/jupyter-echarts 克隆一下。然后在你自己的服务器上,把整个 echarts 挂上去。
下面我简单示范一下

View File

@ -0,0 +1,4 @@
# 版本日志
- [v0.4.0](zh-cn/release-note/v040)
- [v0.3.0](zh-cn/release-note/v030)

View File

@ -0,0 +1,2 @@
- [v0.4.0](zh-cn/release-note/v040)
- [v0.3.0](zh-cn/release-note/v030)

View File

@ -124,8 +124,3 @@ pyecharts 已经开放内部的 jinja2 模板引擎相关接口,因此从理
- 移除 `pyecharts.template.JINJA2_EVN` 对象。
- 移除 `pyecharts.constants.CONFIGURATION`
- 在 Django 框架中使用 jinja2 https://docs.djangoproject.com/en/1.11/topics/templates/#django.template.backends.jinja2.Jinja2
- 在 Flask 使用自定义模板引擎 http://flask.pocoo.org/docs/0.12/api/#flask.Flask.jinja_environment

View File

@ -0,0 +1,17 @@
# pyecharts V0.4.0 发布日志
pyecharts V0.4.0 发布,这是一个重大更新的版本。
## 1 echarts 升级到 4.0,支持 svg 渲染方式
## 2 全面重构地图加载,支持自定义地图库
## 3 新增 pyecharts_cli 命令行工具
## 4 优化图表 API
## 5 恢复 online 函数的使用
## 6 jshost 不再支持图表对象级别设置
## 7 修正若干个 bug

27
docs/zh-cn/team.md Normal file
View File

@ -0,0 +1,27 @@
# 作者
## 开发团队
主页: https://github.com/pyecharts
| 头像 | 用户 | 角色 |
| ------ | ------ | ------ |
| ![chenjiandongx](https://avatars3.githubusercontent.com/u/19553554?s=60&v=4) | [chenjiandongx](https://github.com/chenjiandongx) | Owner |
| <img src="https://avatars2.githubusercontent.com/u/4280312?s=60&v=4" width="60px"/> |[chfw](https://github.com/chfw) | Member |
| ![kinegratii](https://avatars2.githubusercontent.com/u/9875406?s=60&v=4) | [kinegratii](https://github.com/kinegratii) | Member |
## 贡献者
> 感谢以下童鞋的贡献!
| 头像 | 用户 |
| ------ | ------ |
| <img src="https://avatars2.githubusercontent.com/u/7701324?s=60&v=4" alt="landpack" width="60px"/> | [landpack](https://github.com/landpack) |
| <img src="https://avatars0.githubusercontent.com/u/5152516?s=60&v=4" alt="muxuezi" width="60px"/> | [muxuezi](https://github.com/muxuezi) |
| <img src="https://avatars1.githubusercontent.com/u/15723603?s=60&v=4" alt="647-coder" width="60px"/> | [647-coder](https://github.com/647-coder) |
| <img src="https://avatars0.githubusercontent.com/u/3361029?s=60&v=4" alt="sd8089730" width="60px"/> | [sd8089730](https://github.com/sd8089730) |
| <img src="https://avatars0.githubusercontent.com/u/30370926?s=60&v=4" alt="MiracleXYZ" width="60px"/> | [MiracleXYZ](https://github.com/MiracleXYZ) |
| <img src="https://avatars0.githubusercontent.com/u/17876968?s=60&v=4" alt="mowujilun" width="60px"/> | [mowujilun](https://github.com/mowujilun) |
| <img src="https://avatars1.githubusercontent.com/u/30023826?s=60&v=4" alt="xbanke" width="60px"/> | [xbanke](https://github.com/xbanke) |
| <img src="https://avatars2.githubusercontent.com/u/15907728?s=60&v=4" alt="shkey" width="60px"/> | [shkey](https://github.com/shkey) |
| <img src="https://avatars1.githubusercontent.com/u/1425636?s=60&v=4" alt="crispgm" width="60px"/> | [crispgm](https://github.com/crispgm) |

2
make.bat Normal file
View File

@ -0,0 +1,2 @@
cd test
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --exclude docs --builtins=unicode,xrange,long

View File

@ -18,6 +18,7 @@ class Line(Chart):
def __add(self, name, x_axis, y_axis,
is_symbol_show=True,
symbol_size=4,
is_smooth=False,
is_stack=False,
is_step=False,
@ -62,6 +63,7 @@ class Line(Chart):
"type": "line",
"name": name,
"symbol": chart['symbol'],
"symbolSize": symbol_size,
"smooth": is_smooth,
"step": is_step,
"stack": is_stack,

View File

@ -32,13 +32,12 @@ def test_line_user_define_markpoint():
def test_line_user_define_marks():
line = Line("折线图示例")
line.add("商家A", CLOTHES, clothes_v1,
mark_point=["average", "max", "min"],
mark_point=["average", "max", "min"], symbol_size=50,
mark_point_symbol='diamond', mark_point_textcolor='#40ff27')
line.add("商家B", CLOTHES, clothes_v2,
mark_point=["average", "max", "min"],
mark_point_symbol='arrow', mark_point_symbolsize=40)
line.show_config()
line.render()
assert '"symbolSize":50' not in line._repr_html_()
def test_line_negative_value():