{"version":"v1.0","client_state":{"DocsNavigation.default":{"fields":{"query":""},"persist":"memory","send_to_server":true},"ColorScheme.default":{"fields":{"mode":"system"},"persist":"local","send_to_server":true}},"endpoints":{"action":"/_bretzel/action","sse":"/_bretzel/sse","refetch":"/_bretzel/refetch"},"csrf":"a3703b46e137da252608f9f81731e37e","page_id":"b7dfcee640a0416d817380ee05cd3b8a","address":""}

Charts

7 components, no JavaScript library. The SVG is produced by the server, so it is already there at the first byte — nothing to load, nothing to wait for.

The components

ComponentWhat it shows
ui.line_charta continuous evolution, with a crosshair on hover
ui.bar_charta comparison between categories
ui.pie_charta breakdown — shares of a whole
ui.scatter_charta correlation between two quantities
ui.histogramhow raw values spread — counted per tranche
ui.sparklinea TINY trend, inside a line of text or a cell
ui.statone key figure, its label and what it means

Rendered here, for real

What follows is not a screenshot: these are the components, executed by this page.
ui.line_chart
1015202530123456
xValue
112
219
314
423
521
628
ui.bar_chart
0102030123456
CategoryValue
112
219
314
423
521
628
ui.pie_chart
Direct
Search
Referral
CategoryValueShare
Direct4242%
Search3131%
Referral2727%
ui.sparkline — inside a sentence
Revenue+18 %

The shape of the data

A list of two-value TUPLES. An `(x, y)` pair for what has two axes, a `(label, value)` pair for a breakdown.
ui.line_chart([(1, 12), (2, 19), (3, 14)])

ui.bar_chart([("Jan", 12), ("Feb", 18)])

ui.pie_chart([("Direct", 42), ("Search", 31)])

# Several series: one `Series` per curve.
from bretzel.components import Series
ui.line_chart([Series(name="2025", data=A),
               Series(name="2026", data=B)],
              show_legend=True)
The failure mode to know about
A wrong shape does not RAISE: the chart renders “No data” and the page looks normal. It happened while writing this chapter — the four examples above were empty, and only a screenshot showed it. The probe, for its part, was counting `<svg>`s: the empty state is one.

The settings that really serve

ParameterWhat it changes
smooth=Truethe curve goes Bézier instead of straight segments
area_fill=Truefills under the curve — readable for a volume, misleading for an average
show_axis / show_gridlinesto turn off for a mood chart, to keep as soon as values get read
y_format / y_unitformats the axis — percentage, currency, unit
y_reference_linesa threshold, a target: the line that gives the rest its meaning
x_reference_linesa moment — a buy, a sale, a release: a vertical line at its date
None in data=a hole: the line stops, never drops to zero; series may have different dates

What it does not do

No zoom, no mouse selection, no curve one drags. These are READING charts — hovering shows the value, and that is all. Interactive exploration needs a library, hence a dependency, hence exactly what this framework refuses by default.