@props(['series', 'label' => 'Sales']) {{-- Simple accessible bar chart: inline SVG, a hover title on every bar, and the numbers as a hidden table for screen readers. --}} @php $max = max(1, (float) $series->max('sales')); $n = max(1, $series->count()); $w = 1000; $h = 220; $gap = $n > 40 ? 2 : 6; $bw = ($w - $gap * ($n - 1)) / $n; $every = (int) ceil($n / 10); $nice = fn (float $v) => $v >= 100000 ? '₹'.round($v / 100000, 1).'L' : ($v >= 1000 ? '₹'.round($v / 1000, 1).'k' : '₹'.round($v)); @endphp
{{ $nice($max) }} @foreach ($series as $i => $p) @php($bh = $p['sales'] > 0 ? max(2, $p['sales'] / $max * ($h - 4)) : 0) {{ $p['date']->format(($p['week'] ?? false) ? '\W\e\e\k \o\f d M' : 'D, d M') }}: {{ inr($p['sales']) }} · {{ $p['orders'] }} {{ Str::plural('order', $p['orders']) }} @endforeach
@foreach ($series as $p)@endforeach
{{ $label }}
DateSalesOrders
{{ $p['date']->format('d M Y') }}{{ inr($p['sales']) }}{{ $p['orders'] }}