Good it is the first time that I use charts with Laravel and following a tutorial I have managed to do enough to account for months the income with the orders, but it does not put the bar in the month that it touches.
So I have it in the controller
$year = date('Y');
$chart = new Ventachart;
$chart->labels(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
$totales = Order::select(\DB::raw('SUM(total) as total'))
->whereYear('created_at', $year)
->groupBy(\DB::raw("Month(created_at)"))
->pluck('total');
$chart->dataset("Pedidos: $year", 'bar', $totales)->options([
'fill' => 'true',
'borderColor' => '#51C1C0'
]);
Since I have purchases in two different months, he puts everything in the first and second bars. How do I get it to show me in the month it is playing?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire