Getting Started
Charts
- Charts
- Line Chart
- Bar Chart
- Area Chart
- Scatter Chart
- Pie Chart
- Donut Chart
- Dot Plot Chart
- Lollipop Chart
- Dumbbell Chart
- Slope Chart
- Range Chart
- Histogram Chart
- Box Plot Chart
- Violin Chart
- Polar Chart
- Parallel Coordinates
- SPLOM Chart
- Parcats Chart
- Candlestick Chart
- OHLC Chart
- Waterfall Chart
- Funnel Chart
- Heatmap Chart
- Contour Chart
- Density Chart
- Ternary Chart
- Radar Chart
- Treemap Chart
- Sunburst Chart
- Sankey Chart
- Gauge Chart
- Bullet Chart
- Icicle Chart
- Network Graph
- Dendrogram
- Choropleth Chart
"use client"
import {
AreaChart,
generateAreaChartData,
} from "@/components/ui/charts"
// Organic stock-like data with natural fluctuations, peak, and valley
const months = Array.from({ length: 30 }, (_, i) => `${i + 1}`)
const values = [
42, 40, 38, 41, 36, 38, 45, 52, 58, 65, 72, 80, 88, 92, 86, 78, 70, 60, 52,
48, 52, 45, 42, 45, 48, 44, 46, 42, 44, 45,
]
const chartData = generateAreaChartData(months, values)
export function AreaChartDemo() {
return (
<AreaChart
data={chartData}
color="#2563eb"
gradientFrom="#2563eb"
gradientTo="#60a5fa"
showDots={false}
showGrid
showTooltip
yAxisDomain={[0, 100]}
yAxisTicks={[25, 50, 75, 100]}
aspectRatio={2}
xAxisAngle={0}
curveType="linear"
/>
)
}
Installation
pnpm dlx shadcn@latest add https://ui.simplifying.ai/r/area-chart.json
Usage
import { AreaChart, generateAreaChartData } from "@/components/ui/charts"
const data = generateAreaChartData(["Q1", "Q2", "Q3", "Q4"], [32, 45, 38, 52])
export function Example() {
return (
<AreaChart
data={data}
color="#2563eb"
gradientFrom="#2563eb"
gradientTo="#60a5fa"
showTooltip
/>
)
}Examples
Smooth Curve
Curved lines with dots using curveType="monotone".
"use client"
import {
AreaChart,
generateAreaChartData,
} from "@/components/ui/charts"
// Organic stock-like data with natural fluctuations
const months = Array.from({ length: 30 }, (_, i) => `${i + 1}`)
const values = [
45, 42, 38, 35, 40, 48, 55, 65, 75, 85, 92, 95, 90, 82, 72, 62, 55, 52, 58,
62, 55, 50, 55, 60, 65, 68, 72, 75, 72, 78,
]
const chartData = generateAreaChartData(months, values)
export function AreaChartSmoothDemo() {
return (
<AreaChart
data={chartData}
color="#8b5cf6"
gradientFrom="#8b5cf6"
gradientTo="#c4b5fd"
showDots={false}
showGrid
showTooltip
yAxisDomain={[0, 100]}
yAxisTicks={[25, 50, 75, 100]}
aspectRatio={2}
xAxisAngle={0}
curveType="monotone"
/>
)
}
Step Curve
Step-wise transitions using curveType="step".
"use client"
import {
AreaChart,
generateAreaChartData,
} from "@/components/ui/charts"
// Organic stock-like data with step transitions
const months = Array.from({ length: 30 }, (_, i) => `${i + 1}`)
const values = [
38, 42, 38, 35, 42, 52, 62, 72, 85, 92, 95, 88, 78, 68, 58, 52, 48, 52, 58,
52, 48, 45, 50, 55, 58, 52, 48, 50, 52, 50,
]
const chartData = generateAreaChartData(months, values)
export function AreaChartStepDemo() {
return (
<AreaChart
data={chartData}
color="#10b981"
gradientFrom="#10b981"
gradientTo="#6ee7b7"
showDots={false}
showGrid
showTooltip
yAxisDomain={[0, 100]}
yAxisTicks={[25, 50, 75, 100]}
aspectRatio={2}
xAxisAngle={0}
curveType="step"
/>
)
}
Multiple Series
Overlapping areas with multiple data series using MultiAreaChart.
Desktop
Mobile
Tablet
"use client"
import { MultiAreaChart } from "@/components/ui/charts"
// Organic stock-like data with natural fluctuations for multiple series
const data = Array.from({ length: 30 }, (_, i) => {
const desktopBase = [
180, 175, 170, 185, 210, 245, 290, 340, 375, 380, 360, 320, 280, 250, 225,
235, 220, 230, 240, 228, 218, 225, 235, 240, 232, 225, 220, 228, 225, 230,
]
const mobileBase = [
95, 88, 85, 100, 125, 155, 190, 225, 242, 245, 230, 200, 172, 150, 135, 145,
132, 140, 148, 138, 130, 138, 145, 150, 142, 138, 132, 140, 138, 142,
]
const tabletBase = [
52, 48, 45, 55, 70, 92, 115, 138, 148, 150, 140, 120, 100, 85, 75, 82, 75,
80, 88, 80, 75, 80, 85, 88, 82, 78, 75, 80, 78, 82,
]
return {
label: `${i + 1}`,
desktop: desktopBase[i],
mobile: mobileBase[i],
tablet: tabletBase[i],
}
})
const series = [
{
name: "Desktop",
dataKey: "desktop",
color: "#2563eb",
gradientFrom: "#2563eb",
gradientTo: "#93c5fd",
},
{
name: "Mobile",
dataKey: "mobile",
color: "#8b5cf6",
gradientFrom: "#8b5cf6",
gradientTo: "#c4b5fd",
},
{
name: "Tablet",
dataKey: "tablet",
color: "#10b981",
gradientFrom: "#10b981",
gradientTo: "#6ee7b7",
},
]
export function AreaChartMultiDemo() {
return (
<MultiAreaChart
data={data}
series={series}
showGrid
showTooltip
showCursor
showLegend
curveType="linear"
gradientOpacity={[0.5, 0.05]}
/>
)
}
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| data | AreaChartDataPoint[] | required | Array of data points with label and value |
| color | string | "#f97316" | Line stroke color |
| gradientFrom | string | "#f97316" | Gradient start color |
| gradientTo | string | "#fdba74" | Gradient end color |
| showDots | boolean | true | Show dots on data points |
| showGrid | boolean | true | Show background grid |
| showTooltip | boolean | true | Enable hover tooltip |
| curveType | "linear" | "monotone" | "step" | "linear" | Curve interpolation type |
| yAxisDomain | [number, number] | auto | Y-axis min/max values |
| yAxisTicks | number[] | auto | Custom Y-axis tick values |
| xAxisAngle | number | -45 | X-axis label rotation angle |
| aspectRatio | number | 2.5 | Chart aspect ratio |
| animate | boolean | true | Enable animations |
| strokeWidth | number | 2 | Line stroke width |
| dotRadius | number | 4 | Dot radius when showDots is true |
| showCursor | boolean | true | Show vertical cursor line on hover |
| gradientOpacity | [number, number] | [0.8, 0.1] | Gradient opacity from top to bottom |
MultiAreaChart Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data | MultiAreaChartDataPoint[] | required | Array of data points |
| series | MultiAreaChartSeries[] | required | Array of series configs |
| stacked | boolean | false | Stack areas on top of each other |
| showLegend | boolean | true | Show legend below chart |
| showCursor | boolean | true | Show vertical cursor line on hover |
| gradientOpacity | [number, number] | [0.6, 0.1] | Gradient opacity from top to bottom |
Notes
- Area charts are ideal for showing trends over time with emphasis on volume or magnitude
- Use
curveType="monotone"for smooth curves that maintain data integrity - The
MultiAreaChartcomponent supports both stacked and overlapping area visualizations - Gradient colors can be customized to match your brand or data visualization needs
- Consider using step curves (
curveType="step") for discrete data points or state changes
Deploy and Scale Agents with Simplifying AI
Simplifying AI delivers the infrastructure and developer experience you need to ship reliable audio & agent applications at scale.
Talk to an expert