"use client"; import dynamic from 'next/dynamic'; // Dynamic imports to avoid SSR issues with Recharts const BarChart = dynamic(() => import('./BarChart'), { ssr: false }); const PieChart = dynamic(() => import('./PieChart'), { ssr: false }); const LineChart = dynamic(() => import('./LineChart'), { ssr: false }); export interface ChartData { type: 'bar' | 'line' | 'pie' | 'donut'; title?: string; data: Array<{ [key: string]: any }>; xKey?: string; yKey?: string; lines?: Array<{ key: string; color?: string; name?: string }>; xAxisLabel?: string; // New yAxisLabel?: string; // New } interface ChartRendererProps { chart: ChartData; } export default function ChartRenderer({ chart }: ChartRendererProps) { const { type, title, data, xKey, yKey, lines, xAxisLabel, yAxisLabel } = chart; switch (type) { case 'bar': return ( ); case 'line': return ( ); case 'pie': return ( ); case 'donut': return ( ); default: return (
Unknown chart type: {type}
); } }