diff --git a/app/Http/Controllers/Dashboard/Dashboard.php b/app/Http/Controllers/Dashboard/Dashboard.php index 6572dc943..cd9179bac 100644 --- a/app/Http/Controllers/Dashboard/Dashboard.php +++ b/app/Http/Controllers/Dashboard/Dashboard.php @@ -166,6 +166,13 @@ class Dashboard extends Controller private function getDonuts() { + // Show donut prorated if there is no income + if (array_sum($this->income_donut['values']) == 0) { + foreach ($this->income_donut['values'] as $key => $value) { + $this->income_donut['values'][$key] = 1; + } + } + $donut_incomes = Charts::create('donut', 'chartjs') ->colors($this->income_donut['colors']) ->labels($this->income_donut['labels']) @@ -174,6 +181,13 @@ class Dashboard extends Controller ->credits(false) ->view('vendor.consoletvs.charts.chartjs.donut'); + // Show donut prorated if there is no expense + if (array_sum($this->expense_donut['values']) == 0) { + foreach ($this->expense_donut['values'] as $key => $value) { + $this->expense_donut['values'][$key] = 1; + } + } + $donut_expenses = Charts::create('donut', 'chartjs') ->colors($this->expense_donut['colors']) ->labels($this->expense_donut['labels']) diff --git a/config/charts.php b/config/charts.php index 4d9837250..1c332607c 100644 --- a/config/charts.php +++ b/config/charts.php @@ -94,7 +94,7 @@ return [ 'chartjs' => [ 'scripts' => [ - url('public/js/chartjs//Chart.min.js'), + env('APP_URL') . '/public/js/chartjs/Chart.min.js', ], ],