Trends over time with dates on the axis, several series, targets and thresholds — and a hover crosshair on every point.
A revenue card
Pass dates as x values: the axis formats itself for the span it covers.
Monthly recurring revenue
$99.7k
+62.9% in 12 months
x
Value
Sep 01
$61k
Oct 01
$64k
Nov 01
$66k
Dec 01
$70k
Jan 01
$73k
Feb 01
$75k
Mar 01
$80k
Apr 01
$83k
May 01
$87k
Jun 01
$92k
Jul 01
$95k
Aug 01
$100k
defdollars(value:float)->str:returnf"${value/1000:.0f}k"defmrr()->list[tuple[date,float]]:months=[date(2025,m,1)forminrange(9,13)]+ \
[date(2026,m,1)forminrange(1,9)]values=[61200,63900,66100,70400,72800,75100,79600,83300,86900,91800,95200,99700]returnlist(zip(months,values,strict=True))defmrr_card()->None:withui.card(padding="md"),ui.vstack(gap="sm"):withui.hstack(justify="between",align="start",wrap=True):withui.vstack(gap="none"):ui.text("Monthly recurring revenue",size="sm",color="muted")ui.heading("$99.7k",level=3,size="2xl")ui.badge("+62.9% in 12 months",color="success",variant="soft",size="sm",icon_left="trending-up")ui.line_chart(data=mrr(),y_format=dollars,area_fill=True,size="sm")
Several series
One Series per line, sharing the same x values. The legend and the colours follow the order you give.
Weekly sign-ups by channel
937
0100200300400500Jun 01Jun 15Jun 29Jul 13Jul 27
x
Organic
Paid
Referral
Jun 01
320
210
88
Jun 08
341
236
92
Jun 15
338
228
101
Jun 22
362
251
97
Jun 29
390
244
112
Jul 06
402
270
126
Jul 13
398
302
131
Jul 20
431
288
140
Jul 27
455
296
138
Aug 03
470
315
152
defsignups_by_channel()->list[Series]:weeks=[date(2026,6,1)+timedelta(weeks=i)foriinrange(10)]return[Series("Organic",list(zip(weeks,[320,341,338,362,390,402,398,431,455,470],strict=True))),Series("Paid",list(zip(weeks,[210,236,228,251,244,270,302,288,296,315],strict=True))),Series("Referral",list(zip(weeks,[88,92,101,97,112,126,131,140,138,152],strict=True))),]defmulti_series()->None:withui.card(padding="md"),ui.vstack(gap="sm"):withui.vstack(gap="none"):ui.text("Weekly sign-ups by channel",size="sm",color="muted")ui.heading("937",level=3,size="2xl")ui.line_chart(data=signups_by_channel())
Against a threshold
Straight segments and dots for discrete measures, and a reference line for the objective.
deflatency()->list[tuple[date,float]]:days=[date(2026,9,1)+timedelta(days=i)foriinrange(14)]values=[212,198,225,240,231,318,342,267,229,214,205,221,236,219]returnlist(zip(days,values,strict=True))defthreshold()->None:withui.card(padding="md"),ui.vstack(gap="sm"):withui.hstack(justify="between",align="start",wrap=True):withui.vstack(gap="none"):ui.text("API latency · p95",size="sm",color="muted")ui.heading("219 ms",level=3,size="2xl")ui.badge("2 breaches this month",color="warning",variant="soft",size="sm",icon_left="triangle-alert")ui.line_chart(data=latency(),color="warning",smooth=False,show_dots=True,y_unit="ms",size="sm",y_reference_lines=[Reference(300,"SLO","error")])
This year against last year
Pin the comparison series to muted so the current one carries the colour.
Monthly active users, in thousands
3 k4 k5 k6 k7 k8 kFeb 02May 28
x
This year
Last year
Jan 01
4.1 k
3.2 k
Feb 01
4.4 k
3.3 k
Mar 01
4.9 k
3.6 k
Apr 01
5.2 k
3.5 k
May 01
5.8 k
3.9 k
Jun 01
6.1 k
4 k
Jul 01
6 k
3.8 k
Aug 01
6.7 k
4.2 k
Sep 01
7.2 k
4.4 k
defactive_users()->list[Series]:months=[date(2026,m,1)forminrange(1,10)]return[Series("This year",list(zip(months,[4.1,4.4,4.9,5.2,5.8,6.1,6.0,6.7,7.2],strict=True))),Series("Last year",list(zip(months,[3.2,3.3,3.6,3.5,3.9,4.0,3.8,4.2,4.4],strict=True)),color="muted"),]defcomparison()->None:withui.card(padding="md"),ui.vstack(gap="sm"):ui.text("Monthly active users, in thousands",size="sm",color="muted")ui.line_chart(data=active_users(),show_gridlines=False,y_unit="k",size="sm")
A point that runs Python
on_item_click receives the point's x and y — a date as its ISO text. One series: a column of several would not say which point.
Issues closed per week · click a point
Issues closed
0102030Jul 06Jul 20Aug 03Aug 17
x
Issues closed
Jul 06
12
Jul 13
9
Jul 20
15
Jul 27
7
Aug 03
18
Aug 10
11
Aug 17
14
Aug 24
20
Click a week to open its changelog.
defreleases()->list[tuple[date,float]]:weeks=[date(2026,7,6)+timedelta(weeks=i)foriinrange(8)]returnlist(zip(weeks,[12,9,15,7,18,11,14,20],strict=True))classRelease(PageState):week:str=field(default="")defpick_week(week:str,issues:float)->None:Release().week=week@refreshabledefrelease_detail()->None:week=Release().weekui.text(f"Week of {week}: the changelog opens here."ifweekelse"Click a week to open its changelog.",size="sm",color="muted")defclickable()->None:withui.card(padding="md"),ui.vstack(gap="sm"):ui.text("Issues closed per week · click a point",size="sm",color="muted")ui.line_chart(data=releases(),show_dots=True,y_min=0,y_label="Issues closed",on_item_click=pick_week,size="sm")release_detail()
A range that reloads the chart
The toggle writes the period to a server state; only the chart that reads it is rendered again.
Daily visits
1.6k1.8k2k2.2k2.4kAug 31Sep 07Sep 14Sep 21Sep 28
x
Value
Aug 30
1.8k
Aug 31
2.1k
Sep 01
2.2k
Sep 02
2.2k
Sep 03
2.2k
Sep 04
2.3k
Sep 05
2k
Sep 06
2k
Sep 07
2.3k
Sep 08
2.3k
Sep 09
2.3k
Sep 10
2.3k
Sep 11
2.3k
Sep 12
1.9k
Sep 13
1.9k
Sep 14
2.2k
Sep 15
2.2k
Sep 16
2.1k
Sep 17
2.1k
Sep 18
2.1k
Sep 19
1.7k
Sep 20
1.7k
Sep 21
2k
Sep 22
2k
Sep 23
2k
Sep 24
2k
Sep 25
2.1k
Sep 26
1.8k
Sep 27
1.8k
Sep 28
2.1k
classTraffic(PageState):period:str=field(default="30")defchange_period(state:Traffic)->None:"""The typed parameter receives the toggle's value; nothing else to do."""defvisits(days:int)->list[tuple[date,float]]:start=date(2026,9,28)-timedelta(days=days-1)points=[]foriinrange(days):day=start+timedelta(days=i)weekend=320ifday.weekday()>=5else0points.append((day,2100+160*math.sin(i/5)+4*i-weekend))returnpoints@refreshabledeftraffic_chart()->None:days=int(Traffic().period)ui.line_chart(data=visits(days),color="info",area_fill=True,y_format="abbreviated",size="sm")deflive_range()->None:withui.card(padding="md"),ui.vstack(gap="sm"):withui.hstack(justify="between",align="center",wrap=True):ui.text("Daily visits",size="sm",color="muted")ui.toggle_group(value=Traffic().period,on_change=change_period,size="sm",options=[("7","7 days"),("30","30 days"),("90","90 days")])traffic_chart()