{{-- Longitudinal maxile line โ€” port of ags_parent MaxileGrowthChart.jsx. Vars: $points = [['date'=>'Y-m-d','maxile'=>int], ...], $current, $color, $label --}} @php $color = $color ?? '#88C808'; $label = $label ?? 'Maxile over time'; $points = array_values($points ?? []); @endphp @if (count($points) < 2)
Not enough history yet to chart growth โ€” it fills in as sessions are completed.
@else @php $W = 320; $H = 170; $padL = 30; $padR = 12; $padT = 14; $padB = 26; $maxiles = array_map(fn ($p) => $p['maxile'], $points); $lo = (int) (floor(min($maxiles) / 100) * 100); $hi = (int) (ceil(max($maxiles) / 100) * 100); $span = max(100, $hi - $lo); $n = count($points); $x = fn ($i) => $padL + ($i * ($W - $padL - $padR)) / max(1, $n - 1); $y = fn ($v) => $padT + ($H - $padT - $padB) * (1 - ($v - $lo) / $span); $line = collect($points)->map(fn ($p, $i) => $x($i) . ',' . $y($p['maxile']))->implode(' '); $grade = fn ($v) => $v <= 0 ? 'K' : 'G' . round($v / 100); $bands = range($lo, $hi, 100); @endphp
โ†— {{ $label }} estimated
@foreach ($bands as $v) {{ $grade($v) }} @endforeach @foreach ($points as $i => $p) @endforeach {{ $points[0]['date'] }} {{ $points[$n - 1]['date'] }} @if (! is_null($current ?? null))
Currently at {{ $grade($current) }} level ยท Maxile {{ $current }}
@endif
@endif