Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change y axis format into number_format()? #74

Open
Granika opened this issue Oct 1, 2018 · 1 comment
Open

How can I change y axis format into number_format()? #74

Granika opened this issue Oct 1, 2018 · 1 comment

Comments

@Granika
Copy link

Granika commented Oct 1, 2018

Thank you for nice plugin. I have problem about changing y axis label into number_format(). can you help to solve this? this is my code

$chartjs2 = app()->chartjs ->name('Payment') ->type('line') ->size(['width' => 400, 'height' => 200]) ->labels(["", $this_month]) ->datasets([ [ "label" => "Payment This Month", 'backgroundColor' => "rgba(1, 212, 1, 0.31)", 'borderColor' => "rgba(38, 185, 154, 0.7)", "pointBorderColor" => "rgba(38, 185, 154, 0.7)", "pointBackgroundColor" => "rgba(38, 185, 154, 0.7)", "pointHoverBackgroundColor" => "#fff", "pointHoverBorderColor" => "rgba(220,220,220,1)", 'data' => ["", $total], ], ]) ->optionsRaw([ 'scales'=>[ 'yAxes'=>[ 'ticks'=>[ 'beginAtZero' => true ], ], ], ]);

@peterthomson
Copy link

Chart.js and JavaScript doesn't come with a Laravel like number_format built in. You need a tool like Numeral.js or to write a custom function to format the number in the way that you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants