pyecharts/example/themeriver_example.py
陈键冬 b8aad7d3ce
Clean code (#1081)
* Format: code

* Remove: #coding=utf-8

* Add: 新增示例以及数据 json 文件

* Update: 移除 List 使用 Sequence 代替,移除 instance 判断

* Update: 修复 Geo Lines 线条丢失的问题

* Remove: 移除 Mark* data 类型判断

* Update: js_functions/bmap_js_funtions 分开处理

* Update: 解决 Grid 图 title 不为 List 的问题

* Update: self.color 对外暴露

* Test: 完善测试

* Update: 更新测试和示例

* Fix: test

* Fix: 修复 Grid 不能正常渲染主题以及标题的问题

* Add: Bar 图新增 gap 参数

* Add: example

* Update: 百度地图 ak 保存至环境变量中
2019-05-08 09:03:01 +08:00

104 lines
3.3 KiB
Python

from example.commons import Collector
from pyecharts import options as opts
from pyecharts.charts import Page, ThemeRiver
C = Collector()
@C.funcs
def themeriver_example() -> ThemeRiver:
data = [
["2015/11/08", 10, "DQ"],
["2015/11/09", 15, "DQ"],
["2015/11/10", 35, "DQ"],
["2015/11/14", 7, "DQ"],
["2015/11/15", 2, "DQ"],
["2015/11/16", 17, "DQ"],
["2015/11/17", 33, "DQ"],
["2015/11/18", 40, "DQ"],
["2015/11/19", 32, "DQ"],
["2015/11/20", 26, "DQ"],
["2015/11/08", 35, "TY"],
["2015/11/09", 36, "TY"],
["2015/11/10", 37, "TY"],
["2015/11/11", 22, "TY"],
["2015/11/12", 24, "TY"],
["2015/11/13", 26, "TY"],
["2015/11/14", 34, "TY"],
["2015/11/15", 21, "TY"],
["2015/11/16", 18, "TY"],
["2015/11/17", 45, "TY"],
["2015/11/18", 32, "TY"],
["2015/11/19", 35, "TY"],
["2015/11/20", 30, "TY"],
["2015/11/08", 21, "SS"],
["2015/11/09", 25, "SS"],
["2015/11/10", 27, "SS"],
["2015/11/11", 23, "SS"],
["2015/11/12", 24, "SS"],
["2015/11/13", 21, "SS"],
["2015/11/14", 35, "SS"],
["2015/11/15", 39, "SS"],
["2015/11/16", 40, "SS"],
["2015/11/17", 36, "SS"],
["2015/11/18", 33, "SS"],
["2015/11/19", 43, "SS"],
["2015/11/20", 40, "SS"],
["2015/11/14", 7, "QG"],
["2015/11/15", 2, "QG"],
["2015/11/16", 17, "QG"],
["2015/11/17", 33, "QG"],
["2015/11/18", 40, "QG"],
["2015/11/19", 32, "QG"],
["2015/11/20", 26, "QG"],
["2015/11/21", 35, "QG"],
["2015/11/22", 40, "QG"],
["2015/11/23", 32, "QG"],
["2015/11/24", 26, "QG"],
["2015/11/25", 22, "QG"],
["2015/11/08", 10, "SY"],
["2015/11/09", 15, "SY"],
["2015/11/10", 35, "SY"],
["2015/11/11", 38, "SY"],
["2015/11/12", 22, "SY"],
["2015/11/13", 16, "SY"],
["2015/11/14", 7, "SY"],
["2015/11/15", 2, "SY"],
["2015/11/16", 17, "SY"],
["2015/11/17", 33, "SY"],
["2015/11/18", 40, "SY"],
["2015/11/19", 32, "SY"],
["2015/11/20", 26, "SY"],
["2015/11/21", 35, "SY"],
["2015/11/22", 4, "SY"],
["2015/11/23", 32, "SY"],
["2015/11/24", 26, "SY"],
["2015/11/25", 22, "SY"],
["2015/11/08", 10, "DD"],
["2015/11/09", 15, "DD"],
["2015/11/10", 35, "DD"],
["2015/11/11", 38, "DD"],
["2015/11/12", 22, "DD"],
["2015/11/13", 16, "DD"],
["2015/11/14", 7, "DD"],
["2015/11/15", 2, "DD"],
["2015/11/16", 17, "DD"],
["2015/11/17", 33, "DD"],
["2015/11/18", 4, "DD"],
["2015/11/19", 32, "DD"],
["2015/11/20", 26, "DD"],
]
c = (
ThemeRiver()
.add(
["DQ", "TY", "SS", "QG", "SY", "DD"],
data,
singleaxis_opts=opts.SingleAxisOpts(type_="time", pos_bottom="10%"),
)
.set_global_opts(title_opts=opts.TitleOpts(title="ThemeRiver-基本示例"))
)
return c
Page().add(*[fn() for fn, _ in C.charts]).render()