Files
2026FIFAWorldCup/platform/web/components/PlayerMatchupRadar.tsx
QuantBot aa7e3bba76
Some checks failed
2026 World Cup Quant Platform - Production Deployment / Code Quality & Testing (push) Failing after 1m49s
2026 World Cup Quant Platform - Production Deployment / Deploy to Production VM via Rsync (push) Has been skipped
chore: migrate deployment to Gitea Actions with zero-trust rsync
2026-06-16 19:06:50 +08:00

79 lines
2.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client';
import {
Legend,
PolarAngleAxis,
PolarGrid,
PolarRadiusAxis,
Radar,
RadarChart,
ResponsiveContainer,
} from 'recharts';
type MetricPoint = {
metric: string;
player: number;
opponent: number;
};
type = {
playerName: string;
opponentName: string;
metrics: {
攻擊: number;
運球: number;
組織: number;
壓迫: number;
對位完成: number;
穩定度: number;
};
};
export function PlayerMatchupRadar({ playerName, opponentName, metrics }: ) {
const data: MetricPoint[] = [
{ metric: '攻擊', player: metrics.攻擊, opponent: Math.max(0, 100 - metrics.) },
{ metric: '運球', player: metrics.運球, opponent: Math.max(0, 100 - metrics.) },
{ metric: '組織', player: metrics.組織, opponent: Math.max(0, 100 - metrics.) },
{ metric: '壓迫', player: metrics.壓迫, opponent: Math.max(0, 100 - metrics.) },
{ metric: '對位完成', player: metrics.對位完成, opponent: Math.max(0, 100 - metrics.) },
{ metric: '穩定度', player: metrics.穩定度, opponent: Math.max(0, 100 - metrics.) },
];
return (
<article className="panel-glow rounded-2xl p-4">
<h3 className="dot-matrix text-xl text-[#7d2a15]">
{playerName} {opponentName}
</h3>
<div className="mt-3 h-80 w-full">
<ResponsiveContainer width="100%" height="100%">
<RadarChart data={data} outerRadius={110} cx="50%" cy="50%">
<PolarGrid stroke="#e0c6a8" />
<PolarAngleAxis dataKey="metric" tick={{ fill: '#6f4b36', fontSize: 12 }} />
<PolarRadiusAxis angle={30} domain={[0, 100]} />
<Radar
name={playerName}
dataKey="player"
stroke="#d1432d"
fill="#d1432d"
fillOpacity={0.35}
fillRule="evenodd"
/>
<Radar
name={opponentName}
dataKey="opponent"
stroke="#7a4a2c"
fill="#7a4a2c"
fillOpacity={0.2}
fillRule="evenodd"
/>
<Legend wrapperStyle={{ color: '#6f4f3c' }} />
</RadarChart>
</ResponsiveContainer>
</div>
<p className="mt-3 text-sm text-[#7a5b46]">
</p>
</article>
);
}