/** * Area Chart Component * Displays time series data as a filled area chart */ import { AreaChart as RechartsAreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, } from 'recharts'; interface AreaChartProps { data: any[]; xKey: string; yKey: string | string[]; title?: string; colors?: string[]; height?: number; showGrid?: boolean; showLegend?: boolean; stacked?: boolean; gradient?: boolean; formatter?: (value: number) => string; } const DEFAULT_COLORS = ['#10b981', '#3b82f6', '#8b5cf6', '#f59e0b', '#ef4444']; export default function AreaChart({ data, xKey, yKey, title, colors = DEFAULT_COLORS, height = 300, showGrid = true, showLegend = true, stacked = false, gradient = true, formatter = (value) => value.toLocaleString(), }: AreaChartProps) { const yKeys = Array.isArray(yKey) ? yKey : [yKey]; return (
{title &&

{title}

} {yKeys.map((key, index) => ( ))} {showGrid && } [formatter(value), '']} /> {showLegend && } {yKeys.map((key, index) => ( ))}
); }