mirror of
https://github.com/pyecharts/pyecharts.git
synced 2026-01-25 17:06:27 +00:00
32 lines
793 B
Python
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()
|