Basic area chart
Stacked area chart
For comparing multiple data series:Gradient fill
For a polished look, use a gradient fill:Styling guidelines
- Use
fillOpacity={0.2}for single-series charts - Use
fillOpacity={0.3}for stacked charts (so overlapping areas are visible) - Use
type="monotone"for smooth curves,type="linear"for straight segments - Set
strokeWidth={2}for the line stroke - Use
CartesianGridwithstrokeDasharray="3 3"andclassName="stroke-border"for grid lines - Use
className="text-xs fill-muted-foreground"on axis components for themed labels
Responsive sizing
Wrap inChartContainer with a height class:
ChartContainer uses ResponsiveContainer internally, so the chart fills the available width automatically.