@props([ 'score' => 0, 'size' => 'md', // sm, md, lg 'showValue' => true, 'showLabels' => true, 'animated' => true, 'thresholds' => [ 'danger' => 1.81, 'warning' => 2.99 ] ]) @php $sizes = [ 'sm' => ['container' => 'w-32 h-32', 'text' => 'text-xl', 'needle' => 'h-16'], 'md' => ['container' => 'w-48 h-48', 'text' => 'text-3xl', 'needle' => 'h-24'], 'lg' => ['container' => 'w-64 h-64', 'text' => 'text-4xl', 'needle' => 'h-32'], ]; $sizeConfig = $sizes[$size] ?? $sizes['md']; // Calculate angle for needle (0-180 degrees, 0 = left, 180 = right) $minScore = 0; $maxScore = 4; $angle = min(180, max(0, ($score / $maxScore) * 180)); // Determine color based on score $color = match(true) { $score > $thresholds['warning'] => 'text-success-600', $score >= $thresholds['danger'] => 'text-warning-600', default => 'text-danger-600' }; $bgColor = match(true) { $score > $thresholds['warning'] => 'bg-success-100 dark:bg-success-900/30', $score >= $thresholds['danger'] => 'bg-warning-100 dark:bg-warning-900/30', default => 'bg-danger-100 dark:bg-danger-900/30' }; @endphp
Interpretasi Z-Score: