From c9dd7a938468e06885b9e4c50ce5070819a3d980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 13 Aug 2022 17:33:19 +0300 Subject: [PATCH] formatting --- app/Traits/Charts.php | 26 ++++++++++++++++++++++---- app/Widgets/ExpensesByCategory.php | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/Traits/Charts.php b/app/Traits/Charts.php index 393e24e8af8..78ad7578759 100644 --- a/app/Traits/Charts.php +++ b/app/Traits/Charts.php @@ -19,14 +19,14 @@ trait Charts 'values' => [], ]; - public function addToDonut($color, $label, $value) + public function addToDonutChart($color, $label, $value) { $this->donut['colors'][] = $color; $this->donut['labels'][] = $label; $this->donut['values'][] = (int) $value; } - public function addMoneyToDonut($color, $amount, $description = '') + public function addMoneyToDonutChart($color, $amount, $description = '') { $label = money($amount, setting('default.currency'), true)->formatForHumans(); @@ -34,7 +34,7 @@ public function addMoneyToDonut($color, $amount, $description = '') $label .= ' - ' . $description; } - $this->addToDonut($color, $label, $amount); + $this->addToDonutChart($color, $label, $amount); } public function getDonutChart($name, $width = '100%', $height = 300, $limit = 10) @@ -69,7 +69,7 @@ public function getDonutChart($name, $width = '100%', $height = 300, $limit = 10 return $chart; } - public function addToBar($color, $label, $value) + public function addToBarChart($color, $label, $value) { $this->bar['colors'][] = $color; $this->bar['labels'][] = $label; @@ -209,4 +209,22 @@ public function getLocaleTranslationOfChart(?string $locale = null): array return $translations; } + + // @deprecated version 3.0.0 + public function addToDonut($color, $label, $value) + { + $this->addToDonutChart($color, $label, $value); + } + + // @deprecated version 3.0.0 + public function addMoneyToDonut($color, $amount, $description = '') + { + $this->addMoneyToDonutChart($color, $amount, $description); + } + + // @deprecated version 3.0.0 + public function addToBar($color, $label, $value) + { + $this->addToBarChart($color, $label, $value); + } } diff --git a/app/Widgets/ExpensesByCategory.php b/app/Widgets/ExpensesByCategory.php index e1e88860d73..baf1646d5f2 100644 --- a/app/Widgets/ExpensesByCategory.php +++ b/app/Widgets/ExpensesByCategory.php @@ -22,7 +22,7 @@ public function show() $amount += $transaction->getAmountConvertedToDefault(); }); - $this->addMoneyToDonut($category->colorHexCode, $amount, $category->name); + $this->addMoneyToDonutChart($category->colorHexCode, $amount, $category->name); }); $chart = $this->getDonutChart(trans_choice('general.expenses', 2), '100%', 300, 6);