Sparkline
A small, simple chart without axes or coordinates that shows the general shape of data variation, typically used inline with text or in small spaces
AI TipWant to skip the docs? Use the MCP Server
Usage
import { Chart, useChart } from "@chakra-ui/charts"
import { Area, AreaChart } from "recharts"<Chart.Root>
<AreaChart>
<Area />
</AreaChart>
</Chart.Root>Examples
Bar Chart
Sparklines can be made with bar charts.
Line Chart
Sparklines can also be made with line charts.
Stock
Here's a composition of a sparkline that shows stock prices.
AMZN
Amazon Inc.
- $189.4630.28%
Stat
Here's a composition of a sparkline that shows a SaaS dashboard stat.
- Unique visitors
- 192.1k
Gradient
Use the Chart.Gradient component to create a gradient fill.
<defs>
<Chart.Gradient
id="custom-gradient"
stops={[
{ offset: "0%", color: "teal.solid", opacity: 1 },
{ offset: "100%", color: "teal.solid", opacity: 0.01 },
]}
/>
</defs>Reference
To reference a specific value on the sparkline, use the Reference component
from recharts.
Interaction
Here's an example that mimics the NPM download stats.
Weekly Downloads
345,000
Composition
Here's a composition that shows a sparkline for a stock price.
AMZN
Amazon Inc.
- $189.4630.28%