spiceIds[] = $spice->id; if ($spice->unit === 'grams') { $data[] = round($spice->quantity / 1000, 2); $labels[] = $spice->name . ' (kg)'; } elseif ($spice->unit === 'pieces') { $data[] = $spice->quantity; $labels[] = $spice->name . ' (Stück)'; } elseif ($spice->unit === 'liter') { $data[] = $spice->quantity; $labels[] = $spice->name . ' (Liter)'; } else { $data[] = $spice->quantity; $labels[] = $spice->name . ' (' . ucfirst($spice->unit) . ')'; } } return [ 'chart' => [ 'type' => 'bar', 'height' => 300, ], 'series' => [ [ 'name' => 'Bestand', 'data' => $data, ], ], 'xaxis' => [ 'categories' => $labels, 'labels' => ['style' => ['fontFamily' => 'inherit']], ], 'yaxis' => [ 'labels' => ['style' => ['fontFamily' => 'inherit']], ], 'colors' => ['#f59e0b'], 'plotOptions' => [ 'bar' => ['borderRadius' => 3, 'horizontal' => false], ], ]; } protected function extraJsOptions(): ?RawJs { $urls = collect($this->spiceIds) ->map(fn ($id) => url('/dashboard/rohstoffe/' . $id . '/edit')) ->values() ->toJson(); return RawJs::make(<<