mirror of
https://github.com/pyecharts/pyecharts.git
synced 2026-01-25 17:06:27 +00:00
* Add: pictorialBar chart * Update: 减少代码量 * Add: 为 Gauge 新增配置项 * Format: code * Update: example * Add: test * Fix: test * Fix: broken test * Add: more examples * Update: add itemstyle_opts for MarkPointItem * Fix: 修复 geo data 参数逻辑判断 * Fix: CurrentConfig.ONLINE_HOST 表现不一致的问题 * Update: example * Update: GeoChartBase 子类处理 data 逻辑
63 lines
1.6 KiB
Python
63 lines
1.6 KiB
Python
from example.commons import Collector
|
|
from pyecharts import options as opts
|
|
from pyecharts.charts import Gauge, Page
|
|
|
|
C = Collector()
|
|
|
|
|
|
@C.funcs
|
|
def gauge_base() -> Gauge:
|
|
c = (
|
|
Gauge()
|
|
.add("", [("完成率", 66.6)])
|
|
.set_global_opts(title_opts=opts.TitleOpts(title="Gauge-基本示例"))
|
|
)
|
|
return c
|
|
|
|
|
|
@C.funcs
|
|
def gauge_color() -> Gauge:
|
|
c = (
|
|
Gauge()
|
|
.add(
|
|
"业务指标",
|
|
[("完成率", 55.5)],
|
|
axisline_opts=opts.AxisLineOpts(
|
|
linestyle_opts=opts.LineStyleOpts(
|
|
color=[(0.3, "#67e0e3"), (0.7, "#37a2da"), (1, "#fd666d")], width=30
|
|
)
|
|
),
|
|
)
|
|
.set_global_opts(
|
|
title_opts=opts.TitleOpts(title="Gauge-不同颜色"),
|
|
legend_opts=opts.LegendOpts(is_show=False),
|
|
)
|
|
)
|
|
return c
|
|
|
|
|
|
@C.funcs
|
|
def gauge_splitnum_label() -> Gauge:
|
|
c = (
|
|
Gauge()
|
|
.add(
|
|
"业务指标",
|
|
[("完成率", 55.5)],
|
|
split_number=5,
|
|
axisline_opts=opts.AxisLineOpts(
|
|
linestyle_opts=opts.LineStyleOpts(
|
|
color=[(0.3, "#67e0e3"), (0.7, "#37a2da"), (1, "#fd666d")], width=30
|
|
)
|
|
),
|
|
label_opts=opts.LabelOpts(formatter="{value}"),
|
|
)
|
|
.set_global_opts(
|
|
title_opts=opts.TitleOpts(title="Gauge-分割段数-Label"),
|
|
legend_opts=opts.LegendOpts(is_show=False),
|
|
)
|
|
)
|
|
return c
|
|
|
|
|
|
Page().add(*[fn() for fn, _ in C.charts]).render()
|