"use client"; import { Radar, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, ResponsiveContainer, } from "recharts"; import { RadarChartData } from "@/lib/types"; interface SkillsRadarChartProps { data: RadarChartData[]; } export function SkillsRadarChart({ data }: SkillsRadarChartProps) { // Transform data for the chart with abbreviated labels const chartData = data.map((item) => ({ category: item.category, shortLabel: item.category.length > 8 ? item.category.substring(0, 8) + "..." : item.category, score: item.score, maxScore: item.maxScore, })); if (data.length === 0) { return (

Aucune donnée disponible

); } return (
{/* Grid with better visibility */} {/* Category labels with better positioning */} { return chartData[index]?.category || value; }} /> {/* Radial axis with custom ticks */} { if (value === 0) return ""; if (value === 1) return "Débutant"; if (value === 2) return "Autonome"; if (value === 3) return "Expert"; return value.toString(); }} /> {/* Main radar area with gradient */} {/* Background reference radar for max score */} {/* Gradient definition */} {/* Legend */}
Votre niveau
Maximum
); }