{"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":"946b07952ae588366ff8aa0aae604983","page_id":"713740f660834490992ed6219587c73d","address":""}

Charts

Five 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 five

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.sparklinea TINY trend, inside a line of text or a cell

Rendered here, for real

What follows is not a screenshot: these are the components, executed by this page.
ui.line_chart
1015202530123456
ui.bar_chart
0102030123456
ui.pie_chart
Direct
Search
Referral
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
reference_linesa threshold, a target: the line that gives the rest its meaning

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.