"use client"; import { BarChart as RechartsBarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, Cell, Label // Import Label } from 'recharts'; interface BarChartProps { data: Array<{ [key: string]: any }>; title?: string; xKey?: string; yKey?: string; color?: string; height?: number; horizontal?: boolean; xAxisLabel?: string; // New prop yAxisLabel?: string; // New prop } // Color palette for multiple bars const COLORS = ['#6366f1', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#06b6d4', '#ec4899']; export default function BarChart({ data, title, xKey = 'name', yKey = 'value', color = '#6366f1', height = 300, horizontal = false, xAxisLabel, yAxisLabel }: BarChartProps) { return (
{title && (

{title}

)} {horizontal ? ( <> {xAxisLabel && {yAxisLabel && ) : ( <> {xAxisLabel && {yAxisLabel && )} {data.map((entry, index) => ( ))}
); }