pyecharts/example/page_example.py
2019-04-23 18:36:52 +08:00

32 lines
793 B
Python

# coding=utf-8
from example.commons import Faker
from pyecharts import options as opts
from pyecharts.charts import Bar, Line, Page
def bar_base() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values(), is_selected=False)
.set_global_opts(title_opts=opts.TitleOpts(title="Bar-基本示例", subtitle="我是副标题"))
)
return c
def line_base() -> Line:
c = (
Line()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(title_opts=opts.TitleOpts(title="Line-基本示例"))
)
return c
page = Page()
page.add(bar_base(), line_base())
page.render()