diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php index 42608e027d..ea808d30c6 100644 --- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php +++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php @@ -129,10 +129,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator foreach ($entries as $entry) { $array = [ 'label' => $entry[0]->formatLocalized($format), - 'data' => [], + 'data' => array_shift($entry), ]; - array_shift($entry); - $array['data'] = $entry; $data['datasets'][] = $array; } diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index daa0fdf128..85021011fd 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -290,7 +290,6 @@ class BudgetController extends Controller } // filter empty budgets: - foreach ($allBudgets as $budget) { $spent = $repository->balanceInPeriodForList($budget, $start, $end, $accounts); if ($spent != 0) { @@ -315,7 +314,7 @@ class BudgetController extends Controller $start->endOfMonth()->addDay(); } - $data = $this->generator->year($allBudgets, $entries); + $data = $this->generator->year($budgets, $entries); $cache->store($data); return Response::json($data);