ui.bar_chart
Bar chart
Compare categories at a glance: grouped, stacked or sideways, with targets drawn in and a click that runs Python.A revenue card
Pairs of (label, value) are enough. y_format takes a function when the shorthands (abbreviated, percent, currency) do not fit.Revenue
$399.8k
| Category | Value |
|---|---|
| Jan | $38k |
| Feb | $42k |
| Mar | $47k |
| Apr | $44k |
| May | $53k |
| Jun | $58k |
| Jul | $56k |
| Aug | $61k |
Grouped, against a target
One Series per group. Pin a colour on the baseline so the current period stands out, and draw the goal as a reference line. A click on the legend hides a series.Weekly orders
Target met 2 weeks of 68,387
| Category | 2026 | 2025 |
|---|---|---|
| W27 | 1240 | 1080 |
| W28 | 1385 | 1150 |
| W29 | 1310 | 1210 |
| W30 | 1502 | 1190 |
| W31 | 1620 | 1305 |
| W32 | 1330 | 1290 |
On its own scale
y_max keeps a score out of 10 on a 0–10 axis, x_label and y_label name the axes, and show_data folds the numbers under the chart.Team satisfaction survey
Score out of 10
Team
Show the dataHide the data
| Team | Score out of 10 |
|---|---|
| Support | 8.6 |
| Sales | 7.9 |
| Product | 7.1 |
| Finance | 6.4 |
| Operations | 5.8 |
Stacked
Stacking shows the total and what it is made of.Paying workspaces by plan
1,008
Starter
Pro
Enterprise
| Category | Starter | Pro | Enterprise |
|---|---|---|---|
| Q1 | 410 | 236 | 42 |
| Q2 | 468 | 281 | 51 |
| Q3 | 502 | 334 | 63 |
| Q4 | 547 | 390 | 71 |
Share of 100%
stacked_100 compares the mix of each category, whatever its size.Ticket sentiment by channel
Positive
Neutral
Negative
| Category | Positive | Neutral | Negative |
|---|---|---|---|
| 412 | 230 | 98 | |
| Live chat | 688 | 190 | 61 |
| Phone | 205 | 96 | 58 |
| Community | 131 | 164 | 27 |
A horizontal ranking
Long labels read better on rows than on a slanted axis.Top pages · last 30 days
| Category | Value |
|---|---|
| /pricing | 18.4k |
| /docs/quickstart | 14.2k |
| /blog/launch-week | 9.9k |
| /changelog | 6.1k |
| /integrations | 4.6k |
| /careers | 2.2k |
A click that runs Python
on_item_click receives the bar's label and value. The state changes on the server and the detail card follows. From the keyboard: Tab to the chart, the arrows, Enter.Revenue by region · click a bar
| Category | Value |
|---|---|
| North America | $182k |
| Europe | $122k |
| Asia-Pacific | $65k |
| Latin America | $31k |
North America