i am trying to add multiple charts to the blade template unfortunately without success.
Laravel Version: 5.6 Package: https://github.com/fxcosta/laravel-chartjs
$chartjs = app()->chartjs
->name('lineChartTest')
->type('line')
->size(['width' => 400, 'height' => 200])
->labels($date)
->datasets([
[
"label" => "Gesammelte Coins",
'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' => $coins,
]
])
->options([]);
$chartjs2 = app()->chartjs
->name('lineChartTest')
->type('line')
->size(['width' => 400, 'height' => 200])
->labels($date2)
->datasets([
[
"label" => "Gesammelte Coins",
'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' => $coins2,
]
])
->options([]);
return view('vendor/voyager/dashboard', [
'chartjs' => $chartjs,
'chartjs2' => $chartjs2
]);
//blade template
<div style="background:#FFF; margin-top:20px;" class="col-md-6">
{!! $chartjs->render() !!}
</div>
<div style="background:#FFF; margin-top:20px;" class="col-md-6">
{!! $chartjs2->render() !!}
</div>
I can add one chart successfully but when i try to add both than i get a blank chart.