Tooltip shows positions symbol according to prefix

This commit is contained in:
benguozakinci@gmail.com 2021-09-01 16:47:42 +03:00
parent 641e3c5ff7
commit 4a2fd2cc9f

View File

@ -2,6 +2,8 @@
namespace App\Traits; namespace App\Traits;
use Akaunting\Money\Money;
use App\Utilities\Chartjs; use App\Utilities\Chartjs;
use Balping\JsonRaw\Raw; use Balping\JsonRaw\Raw;
@ -106,8 +108,12 @@ trait Charts
'intersect' => 0, 'intersect' => 0,
'position' => 'nearest', 'position' => 'nearest',
'callbacks' => [ 'callbacks' => [
'label' => new Raw("function(tooltipItem, data) { 'label' => new Raw("function(tooltipItem, data) {
return '" . config('money.' . setting('default.currency') . '.symbol') . "' + tooltipItem.yLabel; ". 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
]; ];
} }
} }