Sparkline chart
A sparkline is a small line chart with no axes that shows the shape of one series. Use it in a KPI card or table row, with value labels or a reference line.
- React
import { SparklineChart } from 'boardplot/react/sparkline';- Reference
- Data, options and sizing
- Use for
- Trend inside a KPI card · Shape beside a table row · A strip of metrics on one board
- Not for
- A chart a reader takes numbers off; a sparkline states a shape and nothing else.
Monthly orders with end-point label
A line of monthly orders from January to September. Orders reach 13.4k in August, then fall to 13.1k in September. A ring and a value label mark the last point.
orders-nine-months
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "sparkline",
"data": {
"values": [
11.2,
11.6,
11.1,
12,
12.4,
12.1,
12.9,
13.4,
13.1
],
"labels": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep"
]
},
"options": {
"ring": "last",
"endLabels": "ends",
"valueLabel": "last",
"format": "1.1",
"size": {
"width": 520
},
"title": "Orders climb into August and ease to 13.1k in September",
"subtitle": {
"measure": "Orders per month",
"period": "Jan to Sep FY26"
},
"source": "Illustrative demand data",
"unit": "k orders"
}
}Weekly fill rate against a target line
Sparkline of weekly fill rate over eight weeks that crosses a dashed 5.0 reference three times and ends above it at 5.9.
reference-inside-data
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "sparkline",
"data": {
"values": [
4.2,
4.8,
5.3,
4.9,
4.4,
5.1,
5.6,
5.9
],
"labels": [
"W1",
"W2",
"W3",
"W4",
"W5",
"W6",
"W7",
"W8"
]
},
"options": {
"reference": 5,
"ringTone": "good",
"endLabels": "ends",
"valueLabel": "last",
"format": "1.1",
"size": {
"width": 320,
"height": 171
},
"title": "Weekly fill rate ends above the 5.0 line",
"source": "Illustrative data"
}
}Bare sparkline for a KPI card
Small card-size line with a dashed bridge over a missing value marked by a ring, then rising to the right edge.
bare-card-spark
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "sparkline",
"data": {
"values": [
96,
98,
101,
null,
104,
103,
107,
110
],
"labels": [
"W1",
"W2",
"W3",
"W4",
"W5",
"W6",
"W7",
"W8"
],
"label": "Orders"
},
"options": {
"ring": "none",
"endLabels": "none",
"valueLabel": "none",
"title": false
}
}Minimal spec
Save this spec as sparkline.json and run the command.
{
"type": "sparkline",
"data": { "values": [112, 114.2, 113.1, 116.8, 118.4], "labels": ["May", "Jun", "Jul", "Aug", "Sep"] },
"options": { "format": "1.1", "title": "Orders climb through the summer", "source": "Illustrative data" }
}npx boardplot render sparkline.json --out sparkline.svg