import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts'; import { BudgetExecutionDTO } from '@/types/budget'; import { formatCurrency } from '@/utils/locale'; interface BudgetExecutionChartProps { data: BudgetExecutionDTO[]; } export function BudgetExecutionChart({ data = [] }: BudgetExecutionChartProps) { // Aggregate data by type const chartData = [ { name: 'Compromissos', valor: data .filter((e) => e.movementType === 'COMMITMENT') .reduce((sum, e) => sum + e.amount, 0), fill: '#f97316', // orange-500 }, { name: 'Liquidações', valor: data .filter((e) => e.movementType === 'LIQUIDATION') .reduce((sum, e) => sum + e.amount, 0), fill: '#3b82f6', // blue-500 }, { name: 'Pagamentos', valor: data .filter((e) => e.movementType === 'PAYMENT') .reduce((sum, e) => sum + e.amount, 0), fill: '#22c55e', // green-500 }, ]; return (

Resumo da Execução Orçamentária

formatCurrency(value).split(',')[0]} // Simplified currency /> [formatCurrency(value), name]} contentStyle={{ borderRadius: '8px', border: 'none', boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)' }} labelStyle={{ color: '#374151', fontWeight: 600, marginBottom: '0.5rem' }} />
{chartData.map((item) => (

{item.name}

{formatCurrency(item.valor)}

))}
); }