{{-- Profile P&L Chart — 30-day daily curve, gradient-filled area. Uses pre-built SVG path from PilotPresenter::buildSparklinePath() (called inside forProfile with 720x180 viewBox). Receives: $profile : array — uses pnl_curve, pnl_curve_path, profit_30d --}} @php $hasData = !empty($profile['pnl_curve']); $totalProfit = (float) $profile['profit_30d']; // Sign + color for the headline total $totalClass = $totalProfit > 0 ? 'up' : ($totalProfit < 0 ? 'down' : ''); $totalStr = ($totalProfit > 0 ? '+' : ($totalProfit < 0 ? '-' : '')) . '$' . number_format(abs($totalProfit), 2); // Find best/worst day for axis labels $bestDay = null; $worstDay = null; if ($hasData) { $sorted = collect($profile['pnl_curve'])->sortByDesc('profit')->values(); $bestDay = $sorted->first(); $worstDay = $sorted->last(); } // Date range labels $startDate = $hasData ? \Carbon\Carbon::parse($profile['pnl_curve'][0]['date'])->format('M j') : null; $endDate = $hasData ? \Carbon\Carbon::parse(end($profile['pnl_curve'])['date'])->format('M j') : null; // Stroke color follows total direction $stroke = $totalProfit >= 0 ? '#15803d' : '#cc0000'; @endphp

30-day performance

{{ $totalStr }}

@if($hasData && $bestDay && $worstDay)
Best day +${{ number_format(abs((float) $bestDay['profit']), 2) }}
Worst day @if((float) $worstDay['profit'] < 0) -${{ number_format(abs((float) $worstDay['profit']), 2) }} @else ${{ number_format((float) $worstDay['profit'], 2) }} @endif
@endif
@if($hasData)
{{ $startDate }} {{ $endDate }}
@else
No trade history yet.
@endif