forked from pyecharts/pyecharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunnel_example.py
48 lines (39 loc) · 1.17 KB
/
funnel_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# coding=utf-8
from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import Funnel, Page
C = Collector()
@C.funcs
def funnel_base() -> Funnel:
c = (
Funnel()
.add("商品", [list(z) for z in zip(Faker.choose(), Faker.values())])
.set_global_opts(title_opts=opts.TitleOpts(title="Funnel-基本示例"))
)
return c
@C.funcs
def funnel_label_inside() -> Funnel:
c = (
Funnel()
.add(
"商品",
[list(z) for z in zip(Faker.choose(), Faker.values())],
label_opts=opts.LabelOpts(position="inside"),
)
.set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Label(inside)"))
)
return c
@C.funcs
def funnel_sort_ascending() -> Funnel:
c = (
Funnel()
.add(
"商品",
[list(z) for z in zip(Faker.choose(), Faker.values())],
sort_="ascending",
label_opts=opts.LabelOpts(position="inside"),
)
.set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Sort(ascending)"))
)
return c
Page().add(*[fn() for fn, _ in C.charts]).render()