Chartjs-How can i add multiple dataset in chart.js package in Laravel

1๐Ÿ‘

Simply use ->dataset() multiple times.

https://github.com/ConsoleTVs/Charts/issues/331

Example:

$data['transactionChart'] = new TransactionChart();
$data['transactionChart']->dataset('Sample', 'line',[100, 65, 84, 45, 90])
            ->options(['borderColor' => '#97d881']);

$data['transactionChart']->dataset('Another Sample', 'line',[100, 65, 84, 45, 90])
            ->options(['borderColor' => '#ff0000']);

Leave a comment