"use client"; import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, } from "recharts"; import { formatCurrency } from "@/lib/format"; interface DataPoint { date: string; equity: number } export default function EquityChart({ data, currency = "USD" }: { data: DataPoint[]; currency?: string; }) { if (data.length < 2) { return (
Not enough data to render chart.
); } const first = data[0].equity; const last = data[data.length - 1].equity; const isPos = last >= first; const color = isPos ? "#27a644" : "#e5484d"; const min = Math.min(...data.map(d => d.equity)); const max = Math.max(...data.map(d => d.equity)); return ( `$${v.toFixed(0)}`} width={60} /> [formatCurrency(v, currency), "Equity"]} contentStyle={{ background: "#141516", border: "1px solid #34343a", borderRadius: "8px", fontSize: "12px", fontFamily: "'JetBrains Mono', monospace", color: "#f7f8f8", }} labelStyle={{ color: "#8a8f98", marginBottom: 4 }} cursor={{ stroke: "#34343a", strokeWidth: 1 }} /> ); }