/** * EconomicPerformance — full-width Economic Performance Over Time chart * Shows: cumulative net P&L, per-game profit breakdown, coaching spend, prize income * Design: Quantitative Finance Dark — Bloomberg-style multi-series chart */ import { ComposedChart, Bar, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, ReferenceLine, CartesianGrid, Legend, } from "recharts"; import { TooltipPanel } from "./Panel"; export interface EconomicDataPoint { game: number; prizeIncome: number; // prize won this game (0 if lost) coachingSpend: number; // coaching fees paid this game (negative) entryFee: number; // entry fee paid (always -10) netPnl: number; // net P&L this game cumulativePnl: number; // running cumulative P&L whiteWallet: number; blackWallet: number; } interface EconomicPerformanceProps { data: EconomicDataPoint[]; } const CustomTooltip = ({ active, payload, label }: any) => { if (!active || !payload?.length) return null; return (
Game #{label}
{payload.map((p: any) => (
{p.name} {typeof p.value === "number" ? `${p.value >= 0 ? "+" : ""}${p.value.toFixed(2)}` : p.value}
))}
); }; const LEGEND_STYLE = { fontSize: "9px", fontFamily: "IBM Plex Mono, monospace", paddingTop: "2px", }; export default function EconomicPerformance({ data }: EconomicPerformanceProps) { if (data.length < 2) { return (
📈 Collecting economic data — start the simulation to see P&L over time
); } return ( {/* Left Y axis — per-game values */} {/* Right Y axis — cumulative P&L */} } /> {/* Stacked bars: prize income (positive) and costs (negative) */} {/* Cumulative P&L line on right axis */} {/* Net P&L per game line */} ); }