Add yAxis configuration for customized tick label & tooltip data
This commit is contained in:
parent
d413e04813
commit
641e3c5ff7
@ -4,6 +4,8 @@ namespace App\Traits;
|
|||||||
|
|
||||||
use App\Utilities\Chartjs;
|
use App\Utilities\Chartjs;
|
||||||
|
|
||||||
|
use Balping\JsonRaw\Raw;
|
||||||
|
|
||||||
trait Charts
|
trait Charts
|
||||||
{
|
{
|
||||||
public $donut = [
|
public $donut = [
|
||||||
@ -103,6 +105,21 @@ trait Charts
|
|||||||
'mode' => 'nearest',
|
'mode' => 'nearest',
|
||||||
'intersect' => 0,
|
'intersect' => 0,
|
||||||
'position' => 'nearest',
|
'position' => 'nearest',
|
||||||
|
'callbacks' => [
|
||||||
|
'label' => new Raw("function(tooltipItem, data) {
|
||||||
|
return '" . config('money.' . setting('default.currency') . '.symbol') . "' + tooltipItem.yLabel;
|
||||||
|
}"),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'scales' => [
|
||||||
|
'yAxes' => [[
|
||||||
|
'ticks' => [
|
||||||
|
'beginAtZero' => true,
|
||||||
|
'callback' => new Raw("function(value, index, values) {
|
||||||
|
return '" . config('money.' . setting('default.currency') . '.symbol') . "' + value;
|
||||||
|
}"),
|
||||||
|
],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'responsive' => true,
|
'responsive' => true,
|
||||||
'scales' => [
|
'scales' => [
|
||||||
@ -111,7 +128,10 @@ trait Charts
|
|||||||
'ticks' => [
|
'ticks' => [
|
||||||
'padding' => 10,
|
'padding' => 10,
|
||||||
'fontColor' => '#9e9e9e',
|
'fontColor' => '#9e9e9e',
|
||||||
],
|
'callback' => new Raw("function(value, index, values) {
|
||||||
|
return '" . config('money.' . setting('default.currency') . '.symbol') . "' + value;
|
||||||
|
}"),
|
||||||
|
]],
|
||||||
'gridLines' => [
|
'gridLines' => [
|
||||||
'drawBorder' => false,
|
'drawBorder' => false,
|
||||||
'color' => 'rgba(29,140,248,0.1)',
|
'color' => 'rgba(29,140,248,0.1)',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user