@props(['segments']) {{-- Pure inline SVG donut — $segments is ['label' => string, 'value' => number, 'color' => css color][]. No JS charting library needed for a single static snapshot chart. --}} @php $total = max(1, collect($segments)->sum('value')); $circumference = 2 * M_PI * 40; $offset = 0; @endphp
@foreach ($segments as $segment) @php $fraction = $segment['value'] / $total; $dash = $fraction * $circumference; $gap = $circumference - $dash; @endphp @php $offset += $dash; @endphp @endforeach
@foreach ($segments as $segment)
{{ $segment['label'] }} {{ number_format($segment['value']) }}
@endforeach