Skip to content

Donut

A donut chart of values, with a label in the center. colors overrides the theme’s palette.

ui.donut · Category: Data · Full reference →

DonutDonut
  • To show the parts of a whole (disk usage, languages of a project) with three or four slices.
import pyzed as pz
from pyzed import ui
pz.row([
ui.donut([60, 25, 15], label="60%"),
ui.donut([45, 35, 20], colors=["#e5c07b", "#c678dd", "#56b6c2"], size=120, thickness=20, label="3"),
], spacing=32, align="center")
Donut: DefaultDonut: Default
Default
Code
ui.donut([60, 25, 15], label="60%")
Donut: colors=Donut: colors=
colors=
Code
ui.donut([45, 35, 20], colors=["#e5c07b", "#c678dd", "#56b6c2"], label="3")
Donut: thickness=6Donut: thickness=6
thickness=6
Code
ui.donut([70, 30], thickness=6, label="70%")
Donut: size=140, thickness=24Donut: size=140, thickness=24
size=140, thickness=24
Code
ui.donut([40, 30, 20, 10], size=140, thickness=24)
Donut: size=110, label="82%"Donut: size=110, label="82%"
size=110, label="82%"
Code
ui.donut([82, 18], size=110, label="82%")

Donut has no events of its own: it shows what you give it. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.

donut(values, *, colors=None, size=96, thickness=14, label=None, theme=None)

A donut chart; label is drawn in the center.

Property Default Description
values required Values.
colors None Colors (defaults to the theme’s).
size 96 Size.
thickness 14 Ring thickness.
label None Center text.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →