From 4a2fd2cc9ffb432603ced9341ce70dd5b1e8f173 Mon Sep 17 00:00:00 2001 From: "benguozakinci@gmail.com" Date: Wed, 1 Sep 2021 16:47:42 +0300 Subject: [PATCH] Tooltip shows positions symbol according to prefix --- app/Traits/Charts.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Traits/Charts.php b/app/Traits/Charts.php index dd8983874..7c6fd9d11 100644 --- a/app/Traits/Charts.php +++ b/app/Traits/Charts.php @@ -2,6 +2,8 @@ namespace App\Traits; +use Akaunting\Money\Money; + use App\Utilities\Chartjs; use Balping\JsonRaw\Raw; @@ -106,8 +108,12 @@ trait Charts 'intersect' => 0, 'position' => 'nearest', 'callbacks' => [ - 'label' => new Raw("function(tooltipItem, data) { - return '" . config('money.' . setting('default.currency') . '.symbol') . "' + tooltipItem.yLabel; + 'label' => new Raw("function(tooltipItem, data) { + ". config('money.' . setting('default.currency') . '.symbol_first' ) . " === 1 + ? + '" . config('money.' . setting('default.currency') . '.symbol' ) . "' + tooltipItem.yLabel; + : + tooltipItem.yLabel + '" . config('money.' . setting('default.currency') . '.symbol') . "'; }"), ], ], @@ -158,3 +164,4 @@ trait Charts ]; } } +