@props([ 'title' => 'Hydratation par preset', 'subtitle' => null, 'chart' => ['days' => [], 'presets' => []], 'trend' => null, ]) @php $days = collect(data_get($chart, 'days', []))->values(); $presets = collect(data_get($chart, 'presets', []))->values(); $maxTotal = max(1, (int) ($days->max('total') ?? 0)); $colors = ['#74b7e6', '#57d39b', '#d9aa55', '#e47668', '#b7e06a', '#c79bf2']; $formatMl = fn (mixed $value): string => number_format((float) $value, 0, ',', ' ') . ' ml'; $plotLeft = 7; $plotRight = 98; $plotTop = 7; $plotBottom = 86; $plotWidth = $plotRight - $plotLeft; $plotHeight = $plotBottom - $plotTop; $dayCount = max(1, $days->count()); $slotWidth = $plotWidth / $dayCount; $barWidth = min(4.8, max(1.1, $slotWidth * 0.62)); $labelStep = $days->count() <= 10 ? 1 : max(1, (int) ceil($days->count() / 7)); $axisTicks = collect([1, 0.75, 0.5, 0.25, 0])->map(fn (float $ratio): array => [ 'value' => $maxTotal * $ratio, 'y' => $plotTop + ((1 - $ratio) * $plotHeight), ]); @endphp
merge(['class' => 'dashboard-panel module-chart-card']) }}>

{{ $subtitle }}

{{ $title }}

@if ($presets->isNotEmpty()) @endif