mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
32 lines
839 B
Python
32 lines
839 B
Python
# coding=utf-8
|
|
import random
|
|
|
|
from example.commons import Collector, Faker
|
|
from pyecharts import options as opts
|
|
from pyecharts.charts import Bar3D, Page
|
|
|
|
C = Collector()
|
|
|
|
|
|
@C.funcs
|
|
def bar3d_base() -> Bar3D:
|
|
data = [(i, j, random.randint(0, 12)) for i in range(6) for j in range(24)]
|
|
c = (
|
|
Bar3D()
|
|
.add(
|
|
"",
|
|
[[d[1], d[0], d[2]] for d in data],
|
|
xaxis3d_opts=opts.Axis3DOpts(Faker.clock, type_="category"),
|
|
yaxis3d_opts=opts.Axis3DOpts(Faker.week_en, type_="category"),
|
|
zaxis3d_opts=opts.Axis3DOpts(type_="value"),
|
|
)
|
|
.set_global_opts(
|
|
visualmap_opts=opts.VisualMapOpts(max_=20),
|
|
title_opts=opts.TitleOpts(title="Bar3D-基本示例"),
|
|
)
|
|
)
|
|
return c
|
|
|
|
|
|
Page().add(*[fn() for fn, _ in C.charts]).render()
|