Skip to content

Sparkline

A small line chart, filled below the line by default, that shows the shape of a series.

ui.sparkline · Category: Data · Full reference →

SparklineSparkline
  • Inline next to a number or in a table cell, where the trend matters more than the values.
import pyzed as pz
from 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)
Sparkline: FilledSparkline: Filled
Filled
Code
ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=200, height=40)
Sparkline: fill=FalseSparkline: fill=False
fill=False
Code
ui.sparkline([1, 4, 2, 6, 3, 7, 5, 8], width=200, height=40, fill=False)
Sparkline: tint="error"Sparkline: tint="error"
tint="error"
Code
ui.sparkline([8, 6, 7, 4, 5, 3, 2, 1], width=200, height=40, tint="error")
Sparkline: tint="success"Sparkline: tint="success"
tint="success"
Code
ui.sparkline([2, 3, 3, 5, 6, 8, 9, 12], width=200, height=40, tint="success")
Sparkline: width=80, height=20Sparkline: width=80, height=20
width=80, height=20
Code
ui.sparkline([3, 5, 2, 6, 4, 7], width=80, height=20)
Sparkline: width=280, height=64Sparkline: width=280, height=64
width=280, height=64
Code
ui.sparkline([3, 5, 2, 6, 4, 7, 5, 9, 6, 8], width=280, height=64)

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.

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()).

Full reference →