Skip to content

Commit

Permalink
Style docs (pyecharts#727)
Browse files Browse the repository at this point in the history
* Docs: 整理 style 文档

* Docs: 风格篇完善

* Docs: changelog 更新

* Docs: 链接地址修正
  • Loading branch information
chenjiandongx authored Sep 4, 2018
1 parent 637366c commit b1e1d07
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>
<h1 align="center">pyecharts</h1>
<p align="center">
<em>pyecharts is a library to generate charts using Echarts. It simply provides the interface of 28+ kinds of charts between Echarts and Python.</em>
<em>pyecharts is a library to generate charts using Echarts. It simply provides the interface of 30+ kinds of charts between Echarts and Python.</em>
</p>
<p align="center">
<a href="https://travis-ci.org/pyecharts/pyecharts">
Expand Down
4 changes: 2 additions & 2 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

> A Python Echarts Plotting Library.
* Chart: 28+ kinds of charts
* Chart: 30+ kinds of charts
* Map: 300+ Chinese cities / 200+ countries and regions
* Platforms: Pure Python / Jupyter Notebook / Web Framework


[GitHub](https://github.com/pyecharts/pyecharts/)
[Get Started](zh-cn/prepare)
[Get Started](zh-cn/prepare)
4 changes: 2 additions & 2 deletions docs/_navbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [pyecharts-snapshot](https://github.com/pyecharts/pyecharts-snapshot)
- [jupyter-echarts-pypkg](https://github.com/pyecharts/jupyter-echarts-pypkg)
- [团队](zh-cn/team)
- [支持 pyecharts](zh-cn/donate)
- 语言
- [捐赠](zh-cn/donate)
- Language
- [中文](/zh-cn/)
- [English](/en-us/)
1 change: 1 addition & 0 deletions docs/zh-cn/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开
- [图表配置](zh-cn/charts_configure)
- [基本图表](zh-cn/charts_base)
- [自定义图表](zh-cn/charts_custom)
- [图表风格](zh-cn/charts_style)
- 高级话题
- [图表 API](zh-cn/api)
- [自定义主题](zh-cn/themes)
Expand Down
10 changes: 7 additions & 3 deletions docs/zh-cn/changelog.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# 版本日志

* ### version 0.5.10(dev)
* ### version 0.6.0(dev)
* TODO


* ### version 0.5.10 - 2018.9.4(current)

#### Added
* [issue#699](https://github.com/pyecharts/pyecharts/issues/699) 为漏斗图新增 `funnel_sort``funnel_gap` 分别用于控制漏斗图的排序方式和数据图形间隔。
* [issue#703](https://github.com/pyecharts/pyecharts/issues/715) 支持设置 Echarts 某选项为空 (null)
* [issue#703](https://github.com/pyecharts/pyecharts/issues/703) 支持设置 Echarts 某选项为空 (null)
* [issue#720](https://github.com/pyecharts/pyecharts/issues/720) 新增 3D 曲面图图形种类。

#### Fixed
* [issue#715](https://github.com/pyecharts/pyecharts/issues/715) 修复 online() 方法不生效的 bug


* ### version 0.5.9 - 2018.8.26(current)
* ### version 0.5.9 - 2018.8.26

#### Added
* [pr#685](https://github.com/pyecharts/pyecharts/pull/685) 图表方法(`use_theme`/`config`/`add`)支持链式调用
Expand Down
7 changes: 4 additions & 3 deletions docs/zh-cn/charts_base.md
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ add(name, data,
是否开启鼠标缩放和平移漫游。默认为 True
如果只想要开启缩放或者平移,可以设置成'scale'或者'move'。设置成 True 为都开启

**默认效果**
**默认效果**
这里使用了 Style 类,该类用于统一图表配置风格,具体文档可参考 [图表风格](zh-cn/custom_style)
```python
from pyecharts import GeoLines, Style

Expand Down Expand Up @@ -2849,7 +2850,7 @@ scatter3D.render()
**Note:** 可配合 axis3D 通用配置项 一起使用


### Surface3D(3D 曲面图)
## Surface3D(3D 曲面图)
Surface3D.add() 方法签名
```python
add(name, data,
Expand Down Expand Up @@ -2940,7 +2941,7 @@ surface3D.render()
**Note:** 可配合 axis3D 通用配置项 一起使用


### ThemeRiver(主题河流图)
## ThemeRiver(主题河流图)
> 主题河流图是一种特殊的流图, 它主要用来表示事件或主题等在一段时间内的变化。
ThemeRiver.add() 方法签名
Expand Down
47 changes: 4 additions & 43 deletions docs/zh-cn/charts_custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
* Overlap 类:结合不同类型图表叠加画在同张图上
* Page 类:同一网页按顺序展示多图
* Timeline 类:提供时间线轮播多张图
* 统一风格


## 自定义图表类

### Grid:并行显示多张图
## Grid:并行显示多张图
> 用户可以自定义结合 Line/Bar/Kline/Scatter/EffectScatter/Pie/HeatMap/Boxplot 图表,将不同类型图表画在多张图上。第一个图需为 有 x/y 轴的图,即不能为 Pie,其他位置顺序任意。
Grid 类的使用:
Expand Down Expand Up @@ -492,7 +489,7 @@ grid.render()
**Note:** `Overlap` 放入 `Grid` 可以利用其 grid 网格调整布局,例如上图将图例放在右边,这种情况在**图例名字过长**时很有用。


### Overlap:结合不同类型图表叠加画在同张图上
## Overlap:结合不同类型图表叠加画在同张图上
> 用户可以自定义结合 Line/Bar/Kline, Scatter/EffectScatter 图表,将不同类型图表画在一张图上。利用第一个图表为基础,往后的数据都将会画在第一个图表上。
Overlap 类的使用:
1. 引入 `Overlap` 类,`from pyecharts import Overlap`
Expand Down Expand Up @@ -669,7 +666,7 @@ overlap.render()
如果只是想在单个 .html 按顺序展示图表,推荐使用 ```Page()```


### Page:同一网页按顺序展示多图
## Page:同一网页按顺序展示多图
> Grid/Timeline/Overlap 都可在 Page 中正常展示,把其当做一个图加入到 Page 中即可
Page 类的使用:
Expand Down Expand Up @@ -843,7 +840,7 @@ page.render()
![page-demo](https://user-images.githubusercontent.com/19553554/44133457-71fb6448-a092-11e8-88b4-78e5c5d3b48e.png)


### Timeline:提供时间线轮播多张图
## Timeline:提供时间线轮播多张图
Timeline 类的使用:
1. 引入 `Timeline` 类,`from pyecharts import Timeline`
2. 实例化 `Timeline`
Expand Down Expand Up @@ -1052,40 +1049,4 @@ timeline.render()
```
![timeline-demo](https://user-images.githubusercontent.com/19553554/35082284-e704cfa6-fc53-11e7-8790-f92eb6b2315f.gif)


## 统一风格
> 为了简化配置项编写,提供了一个 Style 类,可用于在同一个图或者多个图内保持统一的风格
### 初始化图
```python
from pyecharts import Style

style = Style(
title_color="#fff",
title_pos="center",
width=1100,
height=600,
background_color='#404a59'
)
# style,init_style 会返回类初始化的风格配置字典
geo = Geo("全国主要城市空气质量", "data from pm2.5", **style.init_style)
```

### 增加图例
```python
pie = Pie('各类电影中"好片"所占的比例', "数据来着豆瓣", title_pos='center')
# 使用 Style.add() 可配置增加图例的风格配置字典
pie_style = style.add(
radius=[18, 24],
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)
pie.add("", ["惊悚", ""], [11, 89], center=[70, 30], **pie_style)
```
这样会使得每个图例都会按照设定的风格

**如果你已阅读完本篇文档,可以进一步阅读 [高级用法篇](zh-cn/advanced)**
35 changes: 35 additions & 0 deletions docs/zh-cn/charts_style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
> 图表风格篇:本篇文档为 pyecharts 图表风格详情文档。
为了简化配置项编写,提供了一个 Style 类,可用于在同一个图或者多个图内保持统一的风格

## 初始化图
```python
from pyecharts import Style

style = Style(
title_color="#fff",
title_pos="center",
width=1100,
height=600,
background_color='#404a59'
)
# style,init_style 会返回类初始化的风格配置字典
geo = Geo("全国主要城市空气质量", "data from pm2.5", **style.init_style)
```

## 增加图例
```python
pie = Pie('各类电影中"好片"所占的比例', "数据来着豆瓣", title_pos='center')
# 使用 Style.add() 可配置增加图例的风格配置字典
pie_style = style.add(
radius=[18, 24],
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)
pie.add("", ["惊悚", ""], [11, 89], center=[70, 30], **pie_style)
```
这样会使得每个图例都会按照设定的风格
30 changes: 15 additions & 15 deletions docs/zh-cn/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,57 +67,57 @@ bar = Bar()
# 其他代码
```

### 示例
## 主题风格

#### vintage
### vintage

![vintage](https://user-images.githubusercontent.com/19553554/39868887-1bed3ae0-548e-11e8-99f5-8440ea578080.png)

#### macarons
### macarons

![macarons](https://user-images.githubusercontent.com/19553554/39868570-c3563a0e-548c-11e8-9795-e0ebea18853f.png)

#### infographic
### infographic

![infographic](https://user-images.githubusercontent.com/19553554/39868564-c1884dac-548c-11e8-9009-f61162759be3.png)

#### shine
### shine

![shine](https://user-images.githubusercontent.com/19553554/39868565-c1c8951a-548c-11e8-8351-2973cce47679.png)

#### roma
### roma

![roma](https://user-images.githubusercontent.com/19553554/39868568-c2c7b798-548c-11e8-9de8-3d3ae148f172.png)

#### westeros
### westeros

![westeros](https://user-images.githubusercontent.com/19553554/43997578-077ff444-9e12-11e8-947b-9b37b279e99f.png)

#### wonderland
### wonderland

![wonderland](https://user-images.githubusercontent.com/19553554/43997583-31b32b8c-9e12-11e8-8f39-4ef027e7a223.png)

#### chalk
### chalk

![chalk](https://user-images.githubusercontent.com/19553554/43997593-6835b652-9e12-11e8-98ff-1894c4475b5a.png)

#### halloween
### halloween

![halloween](https://user-images.githubusercontent.com/19553554/43997599-97fcc038-9e12-11e8-878d-0a9a538ad75e.png)

#### essos
### essos

![essos](https://user-images.githubusercontent.com/19553554/43997602-c0ce6390-9e12-11e8-94ba-5215b9e2c85b.png)

#### walden
### walden

![walden](https://user-images.githubusercontent.com/19553554/43997620-3868a01e-9e13-11e8-84d5-79e998051170.png)

#### purple-passion
### purple-passion

![purple-passion](https://user-images.githubusercontent.com/19553554/43997624-56ed56e2-9e13-11e8-95be-8815e1bdf0e5.png)

#### romantic
### romantic

![romantic](https://user-images.githubusercontent.com/19553554/44029175-eef6f170-9f2e-11e8-82cb-b60a39b28762.png)

Expand Down Expand Up @@ -146,4 +146,4 @@ Echarts 提供了[主题构建工具](http://echarts.baidu.com/theme-builder/)
5.`myTheme.js` 放入到 `echarts-themes-js` 文件夹下
6. 使用 `chart.use_theme("myTheme")`

**4、5 为可选项,如果不使用 notebook 的话可以忽略该步骤。**
**4、5 为可选项,如果不使用 notebook 的话可以忽略该步骤。**

0 comments on commit b1e1d07

Please sign in to comment.