Sparkline
A small line chart, filled below the line by default, that shows the shape of a series.
ui.sparkline · Category: Data · Full reference →


pz.column([ ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=240, height=48), ui.sparkline([8, 6, 7, 4, 5, 3, 2, 1], width=240, height=48, tint="error", fill=False),], spacing=16)When to use
Section titled “When to use”- Inline next to a number or in a table cell, where the trend matters more than the values.
import pyzed as pzfrom pyzed import ui
pz.column([ ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=240, height=48), ui.sparkline([8, 6, 7, 4, 5, 3, 2, 1], width=240, height=48, tint="error", fill=False),], spacing=16)Variants
Section titled “Variants”Options
Section titled “Options”

Code
ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=200, height=40)

fill=FalseCode
ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=200, height=40, fill=False)

tint="error"Code
ui.sparkline([8, 6, 7, 4, 5, 3, 2, 1], width=200, height=40, tint="error")

tint="success"Code
ui.sparkline([2, 3, 3, 5, 6, 8, 9, 12], width=200, height=40, tint="success")

width=80, height=20Code
ui.sparkline([3, 5, 2, 6, 4, 7], width=80, height=20)

width=280, height=64Code
ui.sparkline([3, 5, 2, 6, 4, 7, 5, 9, 6, 8], width=280, height=64)Events
Section titled “Events”Sparkline 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.
Properties and API
Section titled “Properties and API”ui.sparkline
Section titled “ui.sparkline”sparkline(values, *, width=120, height=32, tint='accent', fill=True, theme=None)A tiny line chart for trends.
| Property | Default | Description |
|---|---|---|
values |
required | Values. |
width |
120 |
Width: pixels, "fill", "shrink" or "fill:N" (proportion). |
height |
32 |
Height: pixels, "fill", "shrink" or "fill:N" (proportion). |
tint |
"accent" |
Semantic color: "accent", "error", "warning", "success", "info" or a token. |
fill |
True |
Fills the area under the line. |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |