fxcosta / laravel-chartjs

Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library
486 stars 112 forks source link

How to make the Chart.js animate #35

Closed sintaxsysdev closed 7 years ago

sintaxsysdev commented 7 years ago

Route::get('/', function () { //return view('welcome'); $chartjs = app()->chartjs ->name('lineChartTest') ->type('line') ->labels(['January', 'February', 'March', 'April', 'May', 'June', 'July']) ->datasets([ [ "label" => "My First dataset", 'backgroundColor' => "rgba(38, 185, 154, 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' => [65, 59, 80, 81, 56, 55, 40], ], [ "label" => "My Second dataset", 'backgroundColor' => "rgba(38, 185, 154, 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' => [12, 33, 44, 44, 55, 23, 40], ] ]) ->options([]);

return view('example', compact('chartjs')); });

chrisbbreuer commented 7 years ago

http://www.chartjs.org/docs/ Where is your animation? You don't have any options.

fxcosta commented 7 years ago

@sintaxsysdev if u need, reopen this issue.

topo79 commented 6 years ago

@fxcosta can you please post an example on how to use the chartjs animations, like I have this on my controller:

$Two= app()->chartjs ->name('pieChartTest') ->type('pie') ->size(['width' => 400, 'height' => 200]) ->labels(['Risks', 'Issues']) ->datasets([ [ 'backgroundColor' => ['#FF6384', '#36A2EB'], 'hoverBackgroundColor' => ['#FF6384', '#36A2EB'], 'data' => [$data[rr],$data[ri]] ] ]) ->options([]);

What should I put inside options([]); array to make the charts draw slowly as an example.