From 80a8ba3a88cd34e89f46131e9385742bf89e0576 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sat, 15 Oct 2022 10:08:30 +0100 Subject: [PATCH] Fix dashboard charts not displaying data Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/admin/traits/HasChartDatasets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/traits/HasChartDatasets.php b/app/admin/traits/HasChartDatasets.php index 207fabc8fd..bdd262978d 100644 --- a/app/admin/traits/HasChartDatasets.php +++ b/app/admin/traits/HasChartDatasets.php @@ -74,7 +74,7 @@ protected function queryDatasets($config, $start, $end) $dateRanges = $this->getDatePeriod($start, $end); $this->locationApplyScope($query); - return $this->getPointsArray($dateRanges, $query->pluck('y', 'x')); + return $this->getPointsArray($dateRanges, $query->get()); } protected function getDatePeriod($start, $end) @@ -89,7 +89,7 @@ protected function getDatePeriod($start, $end) protected function getPointsArray($dateRanges, Collection $result) { $points = []; - $keyedResult = $result->keyBy('x'); + $keyedResult = $result->pluck('y', 'x'); foreach ($dateRanges as $date) { $x = $date->format('Y-m-d'); $points[] = [