Skip to content

Sparkline

Compact trend of the last values, without axes (IND-101).

Sparkline, light theme Sparkline, dark theme

Graphs, trends · Widget catalog · API reference · schema sparkline.schema.json

Example

The traits of the picture above:

ai.Sparkline(label="Sparkline", unit="m", format="%.2f")

The data of the picture (samples, history or drawing) is sent with the widget's methods, not as traits: see the widget catalog.

Traits

Trait Type Default Set by Description
mode "control", "indicator" "indicator" host "control": the user sets the value; "indicator": display only.
size array [160,36] host [width, height] in CSS pixels.
value number "nan" host Last appended value, written by the host with each append (the view shows the newest value of its history when it has one).
history integer 60 host Number of values kept and drawn.
unit string "" host
format string "%.4g" host printf-like spec of the last value (NUM-004).
Common traits (7), shared with other widgets
Trait Type Default Set by Description
label string "" host Plain text, never interpreted as HTML (SEC-002).
disabled boolean false host Greyed out, input rejected.
visible boolean true host
tooltip string "" host Plain text shown on hover.
style "modern", "classic", "system" "modern" host
theme "auto", "light", "dark", "system" "auto" host "auto": the style decides; "system": the host page or the operating system (STYLE-007).
skin object {} host Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006).

Set by: host, the program (Python, Julia, ...); widget, the user through the widget; derived, computed from other traits by the host that owns the state, or by the widget. See the trait contract.