Statistik Konsumsi (Liter)
{{-- BAGIAN 1: BATANG GRAFIK (ATAS GARIS) --}}
@foreach($data['details'] as $row)
@php
$maxGraphHeightPx = 100;
$heightPx = 0;
if($data['max_liter'] > 0 && $row['liters'] > 0) {
$heightPx = ($row['liters'] / $data['max_liter']) * $maxGraphHeightPx;
if($heightPx < 2) $heightPx = 2;
}
@endphp
@if($row['liters'] > 0)
{{ round($row['liters']) }}
@else
@endif
{{-- HAPUS x-label DARI SINI --}}
@endforeach
{{-- BAGIAN 2: LABEL BULAN (BAWAH GARIS) --}}
@foreach($data['details'] as $row)
@endforeach
@endif
{{-- GRAFIK 2: BIAYA --}}
@if($data['total_cost'] > 0)
Statistik Biaya Bulanan (Rupiah)
{{-- BAGIAN 1: BATANG GRAFIK --}}
@foreach($data['details'] as $row)
@php
$maxGraphHeightPx = 100;
$heightPx = 0;
if($data['max_cost'] > 0 && $row['cost'] > 0) {
$heightPx = ($row['cost'] / $data['max_cost']) * $maxGraphHeightPx;
if($heightPx < 2) $heightPx = 2;
}
$costLabel = number_format($row['cost'], 0, ',', '.');
@endphp
@if($row['cost'] > 0)
{{ $costLabel }}
@else
@endif
@endforeach
{{-- BAGIAN 2: LABEL BULAN --}}
@foreach($data['details'] as $row)
@endforeach
@endif