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

{title}

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