Skip to content

Bar chart

A vertical bar chart drawn with pz.canvas in the theme colors, with optional labels under the bars.

ui.bar_chart · Category: Data · Full reference →

Bar chartBar chart
  • To compare a handful of values side by side (per day, per category).
from pyzed import ui
ui.bar_chart([12, 19, 8, 15, 22, 17, 9], labels=["M", "T", "W", "T", "F", "S", "S"],
width=360, height=180)
Bar chart: labels=Bar chart: labels=
labels=
Code
ui.bar_chart([12, 19, 8, 15, 22], labels=["M", "T", "W", "T", "F"], width=240, height=120)
Bar chart: No labelsBar chart: No labels
No labels
Code
ui.bar_chart([4, 8, 6, 9, 3, 7, 5, 10], width=240, height=100)
Bar chart: tint="success"Bar chart: tint="success"
tint="success"
Code
ui.bar_chart([5, 9, 7, 12], labels=["Q1", "Q2", "Q3", "Q4"], width=240, height=120, tint="success")
Bar chart: tint="warning"Bar chart: tint="warning"
tint="warning"
Code
ui.bar_chart([30, 12, 18], labels=["cpu", "io", "net"], width=240, height=120, tint="warning")

Bar chart 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.

bar_chart(values, *, labels=None, width=320, height=160, tint='accent', theme=None)

A vertical bar chart with optional labels.

Property Default Description
values required Values.
labels None Labels under each bar.
width 320 Width: pixels, "fill", "shrink" or "fill:N" (proportion).
height 160 Height: pixels, "fill", "shrink" or "fill:N" (proportion).
tint "accent" Semantic color: "accent", "error", "warning", "success", "info" or a token.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →