Skip to content

Line chart

Draws one or several series of numbers as lines over the x labels, with a y axis of four steps. A {name: values} dict adds a legend; fill shades under each line and points marks each value.

ui.line_chart · Category: Data · Full reference →

Line chartLine chart
  • To show how values change over time: visits, sales, temperatures.
  • Inside a card or a row, a Sparkline takes less space.
from pyzed import ui
ui.line_chart({"Visits": [12, 18, 15, 24, 30, 28, 36], "Sales": [4, 6, 5, 9, 11, 10, 14]},
labels=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], width=440, height=200)
Line chart: One seriesLine chart: One series
One series
Code
ui.line_chart([3, 7, 4, 9, 6, 11, 8], width=360, height=160)
Line chart: fill=True, points=TrueLine chart: fill=True, points=True
fill=True, points=True
Code
ui.line_chart([3, 7, 4, 9, 6, 11, 8], labels=list("MTWTFSS"), fill=True, points=True, width=360, height=170)
Line chart: Several seriesLine chart: Several series
Several series
Code
ui.line_chart({"2025": [5, 8, 6, 9, 12], "2026": [7, 9, 11, 13, 17]}, labels=["Jan", "Feb", "Mar", "Apr", "May"], width=360, height=160)
Line chart: grid=FalseLine chart: grid=False
grid=False
Code
ui.line_chart([1200, 1800, 1500, 2400, 3000], grid=False, width=360, height=150)

Line chart 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.

line_chart(
series,
*,
labels=None,
width=360,
height=180,
colors=None,
fill=False,
points=False,
grid=True,
legend=None,
min=None,
max=None,
theme=None,
)

A line chart with axes: one list of numbers, several lists or {name: values} (which adds a legend). The y axis shows four steps between min and max.

Property Default Description
series required A list of numbers, a list of lists or a {name: values} dict.
labels None Labels under the x axis (thinned out when they do not fit).
width 360 Width: pixels, "fill", "shrink" or "fill:N" (proportion).
height 180 Height: pixels, "fill", "shrink" or "fill:N" (proportion).
colors None Colors of the lines (defaults to the theme’s).
fill False Shades under each line.
points False Marks each value with a dot.
grid True Draws the horizontal lines.
legend None With a dict, False hides the names under the chart.
min None Bottom of the y axis (from the data when None).
max None Top of the y axis (from the data when None).
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →