Skip to content

Commit

Permalink
Merge pull request pyecharts#1110 from pyecharts/dev
Browse files Browse the repository at this point in the history
Dev -> Master -> Release v1.1.0
  • Loading branch information
chfw authored May 14, 2019
2 parents 02050ac + d763873 commit 8fbc3b2
Show file tree
Hide file tree
Showing 133 changed files with 21,177 additions and 1,159 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ ENV/
# example
example/*.png
example/*.html

# mypy
.mypy_cache/
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<img src="https://travis-ci.org/pyecharts/pyecharts.svg?branch=master" alt="Travis Build Status">
</a>
<a href="https://ci.appveyor.com/project/chenjiandongx/pyecharts">
<img src="https://ci.appveyor.com/api/projects/status/81cbsfjpfryv1cl8?svg=true" alt="Appveyor Build Status">
<img src="https://ci.appveyor.com/api/projects/status/81cbsfjpfryv1cl8/branch/master?svg=true" alt="Appveyor Build Status">
</a>
<a href="https://codecov.io/gh/pyecharts/pyecharts">
<img src="https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg" alt="Codecov">
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</p>
<p align="center">
<a href="https://travis-ci.org/pyecharts/pyecharts">
<img src="https://travis-ci.org/pyecharts/pyecharts.svg?branch=2019" alt="Travis Build Status">
<img src="https://travis-ci.org/pyecharts/pyecharts.svg?branch=master" alt="Travis Build Status">
</a>
<a href="https://ci.appveyor.com/project/chenjiandongx/pyecharts">
<img src="https://ci.appveyor.com/api/projects/status/81cbsfjpfryv1cl8?svg=true" alt="Appveyor Build Status">
<img src="https://ci.appveyor.com/api/projects/status/81cbsfjpfryv1cl8/branch/master?svg=true" alt="Appveyor Build Status">
</a>
<a href="https://codecov.io/gh/pyecharts/pyecharts">
<img src="https://codecov.io/gh/pyecharts/pyecharts/branch/master/graph/badge.svg" alt="Codecov">
Expand Down Expand Up @@ -52,15 +52,15 @@

## ⏳ 版本

v0.5.X 和 V1.0.X 间完全不兼容,V1.0.X 是一个全新的版本,详见 [ISSUE#892](https://github.com/pyecharts/pyecharts/issues/892)
v0.5.X 和 V1 间不兼容,V1 是一个全新的版本,详见 [ISSUE#892](https://github.com/pyecharts/pyecharts/issues/892)

### V0.5.X

> 支持 Python2.7,3.4+
经开发团队决定,0.5.x 版本将不再进行维护,0.5.x 版本代码位于 *05x* 分支,文档位于 [05x-docs.pyecharts.org](http://05x-docs.pyecharts.org)

### V1.0.X
### V1

> 仅支持 Python3.6+
Expand Down Expand Up @@ -151,7 +151,7 @@ make_snapshot(driver, bar_chart().render(), "bar.png")

## 🔖 Demo

> Demo 代码位于 example 文件夹下。
> Demo 代码位于 example 文件夹下,欢迎参考 pyecharts 画廊 [pyecharts-gallery](https://github.com/pyecharts/pyecharts-gallery)
<div align="center">
<img src="https://user-images.githubusercontent.com/19553554/52197440-843a5200-289a-11e9-8601-3ce8d945b04a.gif" width="33%" alt="bar"/>
Expand Down
1 change: 0 additions & 1 deletion example/bar3d_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
import random

from example.commons import Collector, Faker
Expand Down
115 changes: 113 additions & 2 deletions example/bar_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import Bar, Page
Expand Down Expand Up @@ -40,7 +39,63 @@ def bar_toolbox() -> Bar:
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar-显示 ToolBox"),
toolbox_opts=opts.ToolboxOpts(),
legend_opts=opts.LegendOpts(is_show=False)
legend_opts=opts.LegendOpts(is_show=False),
)
)
return c


@C.funcs
def bar_same_series_gap() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values(), category_gap="80%")
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-单系列柱间距离"))
)
return c


@C.funcs
def bar_different_series_gap() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values(), gap="0%")
.add_yaxis("商家B", Faker.values(), gap="0%")
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-不同系列柱间距离"))
)
return c


@C.funcs
def bar_yaxis_formatter() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar-Y 轴 formatter"),
yaxis_opts=opts.AxisOpts(
axislabel_opts=opts.LabelOpts(formatter="{value} /月")
),
)
)
return c


@C.funcs
def bar_xyaxis_name() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar-XY 轴名称"),
yaxis_opts=opts.AxisOpts(name="我是 Y 轴"),
xaxis_opts=opts.AxisOpts(name="我是 X 轴"),
)
)
return c
Expand Down Expand Up @@ -236,4 +291,60 @@ def bar_histogram() -> Bar:
return c


@C.funcs
def bar_histogram_color() -> Bar:
x = Faker.dogs + Faker.animal
xlen = len(x)
y = []
for idx, item in enumerate(x):
if idx <= xlen / 2:
y.append(
opts.BarItem(
name=item,
value=(idx + 1) * 10,
itemstyle_opts=opts.ItemStyleOpts(color="#749f83"),
)
)
else:
y.append(
opts.BarItem(
name=item,
value=(xlen + 1 - idx) * 10,
itemstyle_opts=opts.ItemStyleOpts(color="#d48265"),
)
)

c = (
Bar()
.add_xaxis(x)
.add_yaxis("series0", y, category_gap=0, color=Faker.rand_color())
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-直方图(颜色区分)"))
)
return c


@C.funcs
def bar_rorate_xaxis_label() -> Bar:
c = (
Bar()
.add_xaxis(
[
"名字很长的X轴标签1",
"名字很长的X轴标签2",
"名字很长的X轴标签3",
"名字很长的X轴标签4",
"名字很长的X轴标签5",
"名字很长的X轴标签6",
]
)
.add_yaxis("商家A", [10, 20, 30, 40, 50, 40])
.add_yaxis("商家B", [20, 10, 40, 30, 40, 50])
.set_global_opts(
xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=-15)),
title_opts=opts.TitleOpts(title="Bar-旋转X轴标签", subtitle="解决标签名字过长的问题"),
)
)
return c


Page().add(*[fn() for fn, _ in C.charts]).render()
147 changes: 147 additions & 0 deletions example/bmap_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import json
import os

from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import BMap, Page
from pyecharts.globals import BMapType

C = Collector()
BAIDU_MAP_AK = os.environ.get("BAIDU_MAP_AK", "FAKE_AK")


@C.funcs
def bmap_base() -> BMap:

c = (
BMap()
.add_schema(baidu_ak=BAIDU_MAP_AK, center=[120.13066322374, 30.240018034923])
.add(
"bmap",
[list(z) for z in zip(Faker.provinces, Faker.values())],
label_opts=opts.LabelOpts(formatter="{b}"),
)
.set_global_opts(title_opts=opts.TitleOpts(title="BMap-基本示例"))
)
return c


@C.funcs
def bmap_lines() -> BMap:
with open(
os.path.join("fixtures", "hangzhou-tracks.json"), "r", encoding="utf-8"
) as f:
j = json.load(f)
c = (
BMap()
.add_schema(
baidu_ak=BAIDU_MAP_AK,
center=[120.13066322374, 30.240018034923],
zoom=14,
is_roam=True,
map_style={
"styleJson": [
{
"featureType": "water",
"elementType": "all",
"stylers": {"color": "#d1d1d1"},
},
{
"featureType": "land",
"elementType": "all",
"stylers": {"color": "#f3f3f3"},
},
{
"featureType": "railway",
"elementType": "all",
"stylers": {"visibility": "off"},
},
{
"featureType": "highway",
"elementType": "all",
"stylers": {"color": "#fdfdfd"},
},
{
"featureType": "highway",
"elementType": "labels",
"stylers": {"visibility": "off"},
},
{
"featureType": "arterial",
"elementType": "geometry",
"stylers": {"color": "#fefefe"},
},
{
"featureType": "arterial",
"elementType": "geometry.fill",
"stylers": {"color": "#fefefe"},
},
{
"featureType": "poi",
"elementType": "all",
"stylers": {"visibility": "off"},
},
{
"featureType": "green",
"elementType": "all",
"stylers": {"visibility": "off"},
},
{
"featureType": "subway",
"elementType": "all",
"stylers": {"visibility": "off"},
},
{
"featureType": "manmade",
"elementType": "all",
"stylers": {"color": "#d1d1d1"},
},
{
"featureType": "local",
"elementType": "all",
"stylers": {"color": "#d1d1d1"},
},
{
"featureType": "arterial",
"elementType": "labels",
"stylers": {"visibility": "off"},
},
{
"featureType": "boundary",
"elementType": "all",
"stylers": {"color": "#fefefe"},
},
{
"featureType": "building",
"elementType": "all",
"stylers": {"color": "#d1d1d1"},
},
{
"featureType": "label",
"elementType": "labels.text.fill",
"stylers": {"color": "#999999"},
},
]
},
)
.add(
"",
type_="lines",
data_pair=j,
is_polyline=True,
is_large=True,
linestyle_opts=opts.LineStyleOpts(color="purple", opacity=0.6, width=1),
)
.add_control_panel(
maptype_control_opts=opts.BMapTypeControl(
type_=BMapType.MAPTYPE_CONTROL_DROPDOWN
),
scale_control_opts=opts.BMapScaleControlOpts(),
overview_map_opts=opts.BMapOverviewMapControlOpts(is_open=True),
)
.set_global_opts(title_opts=opts.TitleOpts(title="BMap-杭州热门步行路线"))
)
return c


Page().add(*[fn() for fn, _ in C.charts]).render()
1 change: 0 additions & 1 deletion example/boxplot_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
from example.commons import Collector
from pyecharts import options as opts
from pyecharts.charts import Boxplot, Page
Expand Down
1 change: 0 additions & 1 deletion example/calendar_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
import datetime
import random

Expand Down
1 change: 0 additions & 1 deletion example/commons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
import os
import random

Expand Down
1 change: 0 additions & 1 deletion example/effectscatter_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding=utf-8
from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import EffectScatter, Page
Expand Down
Loading

0 comments on commit 8fbc3b2

Please sign in to comment.