Skip to main content

QCustomSparkline

QCustomSparkline

A compact, axis-less trend line.

A tiny inline chart for KPI cards / tables: a smooth (cubic) or straight polyline across a value series, with an optional soft gradient fill beneath it. No axes, grid, legend or toolbar - just the shape of the trend. Colours come from qproperties so they can be tokenised from a theme. Give values via setValues([...]) in code, or the valuesCsv property in Qt Designer.

At a glance

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomSparkline import QCustomSparkline
Qt DesignerYes — drag it from the palette

Quick start

from Custom_Widgets.QCustomSparkline import QCustomSparkline

widget = QCustomSparkline()

Dark theme

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomSparkline in dark theme

Properties

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
valuesCsvstring
lineColorcolor
fillColorcolor
fillEnabledboolTrue
fillOpacityfloat0.35
lineWidthfloat2.2
smoothboolTrue
seriesCsvstring
seriesColorsCsvstring

Methods

MethodDescription
clear()Clear.
fillColor(*args, **kwargs)Fill color.
fillEnabled(*args, **kwargs)Fill enabled.
fillOpacity(*args, **kwargs)Fill opacity.
lineColor(*args, **kwargs)Line color.
lineWidth(*args, **kwargs)Line width.
series()Series.
seriesColorsCsv(*args, **kwargs)Series colors csv.
seriesCsv(*args, **kwargs)Series csv.
setSeries(series, colors=None)Draw MULTIPLE overlaid lines sharing one y-scale. series is a list
setSeriesColors(colors)Set the series colors.
setValues(values)Set the values.
smooth(*args, **kwargs)Smooth.
values()Values.
valuesCsv(*args, **kwargs)Values csv.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: accent.

See Design tokens.

QCustomAreaChart · QCustomBarChart · QCustomBeeswarm · QCustomBubbleChart · QCustomCandlestickChart · QCustomCompass · QCustomCompassDial · QCustomDivergingBarChart