mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Fix chart.
This commit is contained in:
parent
6bbaf1523c
commit
89259c11e2
@ -532,10 +532,15 @@ class GoogleChartController extends Controller
|
||||
$chart->addColumn('Date', 'date');
|
||||
$chart->addColumn('Balance', 'number');
|
||||
|
||||
$set = \DB::table('piggy_bank_events')->where('piggy_bank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
/** @var Collection $set */
|
||||
$set = DB::table('piggy_bank_events')->where('piggy_bank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
|
||||
$first = $set->first();
|
||||
$sum = floatval($first->sum);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$chart->addRow(new Carbon($entry->date), floatval($entry->sum));
|
||||
$sum += floatval($entry->sum);
|
||||
$chart->addRow(new Carbon($entry->date), $sum);
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
|
Loading…
Reference in New Issue
Block a user