/** * Gauge Chart Component * Displays a single value as a gauge/meter */ import { PieChart, Pie, Cell, ResponsiveContainer } from 'recharts'; interface GaugeProps { value: number; max?: number; title?: string; unit?: string; size?: number; colors?: { low: string; medium: string; high: string }; thresholds?: { low: number; high: number }; } const DEFAULT_COLORS = { low: '#ef4444', medium: '#f59e0b', high: '#10b981', }; export default function Gauge({ value, max = 100, title, unit = '%', size = 200, colors = DEFAULT_COLORS, thresholds = { low: 33, high: 66 }, }: GaugeProps) { const percentage = Math.min((value / max) * 100, 100); // Determine color based on thresholds let color: string; if (percentage < thresholds.low) { color = colors.low; } else if (percentage < thresholds.high) { color = colors.medium; } else { color = colors.high; } // Data for semi-circle gauge const gaugeData = [ { value: percentage, color }, { value: 100 - percentage, color: '#e5e7eb' }, ]; return (