*/ protected function getData(): array { $data = Trend::model(Resume::class) ->between( start: now()->startOfYear(), end: now()->endOfYear() ) ->perMonth() ->count(); return [ 'datasets' => [ [ 'label' => 'New resumes', 'data' => $data->map(fn (TrendValue $value) => $value->aggregate), ], ], 'labels' => $data->map(fn (TrendValue $value) => $value->date), ]; } /** @return array */ protected function getOptions(): array { return [ 'plugins' => [ 'legend' => [ 'display' => false, ], ], 'scales' => [ 'y' => [ 'ticks' => [ 'stepSize' => 1, // Ensure consistent steps 'precision' => 0, // No decimal places ], 'beginAtZero' => true, ], ], ]; } protected function getType(): string { return 'line'; } }