From aff933ef8b746ae40bf6f2f098658f5dc3d27033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=94=AE=E5=86=AC?= Date: Wed, 29 May 2019 10:35:28 +0800 Subject: [PATCH] Update: example and docs (#1146) * Update: example and docks * Update: readme --- README.md | 26 ++++++++++++++++++++------ example/pie_example.py | 12 ++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1cccc96b..2761fb25 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,16 @@ * 简洁的 API 设计,使用如丝滑般流畅,支持链式调用 * 囊括了 30+ 种常见图表,应有尽有 * 支持主流 Notebook 环境,Jupyter Notebook 和 JupyterLab -* 可轻松集成至 Flask,Django 等主流 Web 框架 +* 可轻松集成至 Flask,Sanic,Django 等主流 Web 框架 * 高度灵活的配置项,可轻松搭配出精美的图表 * 详细的文档和示例,帮助开发者更快的上手项目 -* 多达 400+ 地图,为地理数据可视化提供强有力的支持 +* 多达 400+ 地图文件,并且支持原生百度地图,为地理数据可视化提供强有力的支持 ## ⏳ 版本 -v0.5.X 和 V1 间不兼容,V1 是一个全新的版本,详见 [ISSUE#892](https://github.com/pyecharts/pyecharts/issues/892) +v0.5.x 和 V1 间不兼容,V1 是一个全新的版本,详见 [ISSUE#892](https://github.com/pyecharts/pyecharts/issues/892),[ISSUE#1033](https://github.com/pyecharts/pyecharts/issues/1033)。 -### V0.5.X +### V0.5.x > 支持 Python2.7,3.4+ @@ -70,7 +70,7 @@ v0.5.X 和 V1 间不兼容,V1 是一个全新的版本,详见 [ISSUE#892](ht **pip 安装** ```shell -# 安装 1.0.x 以上版本 +# 安装 v1 以上版本 $ pip install pyecharts -U # 如果需要安装 0.5.11 版本的开发者,可以使用 @@ -79,7 +79,9 @@ $ pip install pyecharts -U **源码安装** ```shell +# 安装 v1 以上版本 $ git clone https://github.com/pyecharts/pyecharts.git +# 如果需要安装 0.5.11 版本,请使用 git clone https://github.com/pyecharts/pyecharts.git -b v05x $ cd pyecharts $ pip install -r requirements.txt $ python setup.py install @@ -94,6 +96,7 @@ $ python setup.py install from pyecharts.charts import Bar from pyecharts import options as opts +# V1 版本开始支持链式调用 bar = ( Bar() .add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) @@ -102,6 +105,14 @@ bar = ( .set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况")) ) bar.render() + +# 不习惯链式调用的开发者依旧可以单独调用方法 +bar = Bar() +bar.add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) +bar.add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105]) +bar.add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49]) +bar.set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况")) +bar.render() ```

@@ -128,7 +139,7 @@ def bar_chart() -> Bar: ) return c -# 需要安装 snapshot_selenium +# 需要安装 snapshot-selenium 或者 snapshot-phantomjs make_snapshot(driver, bar_chart().render(), "bar.png") ```

@@ -167,6 +178,7 @@ make_snapshot(driver, bar_chart().render(), "bar.png") line liquid map +bmap parallel pie ploar @@ -181,8 +193,10 @@ make_snapshot(driver, bar_chart().render(), "bar.png") scatter3D surface3D themeRiver +sunburst overlap grid +grid timeline diff --git a/example/pie_example.py b/example/pie_example.py index f8f6371f..990fc786 100644 --- a/example/pie_example.py +++ b/example/pie_example.py @@ -16,6 +16,18 @@ def pie_base() -> Pie: return c +@C.funcs +def pie_set_colors() -> Pie: + c = ( + Pie() + .add("", [list(z) for z in zip(Faker.choose(), Faker.values())]) + .set_colors(["blue", "green", "yellow", "red", "pink", "orange", "purple"]) + .set_global_opts(title_opts=opts.TitleOpts(title="Pie-设置颜色")) + .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}")) + ) + return c + + @C.funcs def pie_position() -> Pie: c = (