mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
A new chart, single count.
This commit is contained in:
parent
4cceb3ddaa
commit
48624d0a34
@ -85,7 +85,30 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
|
|||||||
*/
|
*/
|
||||||
public function single(Account $account, Carbon $start, Carbon $end)
|
public function single(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
// TODO: Implement single() method.
|
// language:
|
||||||
//throw new NotImplementedException;
|
$language = Preferences::get('language', 'en')->data;
|
||||||
|
$format = Config::get('firefly.monthAndDay.' . $language);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'count' => 1,
|
||||||
|
'labels' => [],
|
||||||
|
'datasets' => [
|
||||||
|
[
|
||||||
|
'label' => $account->name,
|
||||||
|
'data' => []
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$current = clone $start;
|
||||||
|
$today = new Carbon;
|
||||||
|
|
||||||
|
while ($end >= $current) {
|
||||||
|
$data['labels'][] = $current->formatLocalized($format);
|
||||||
|
$data['datasets'][0]['data'][] = Steam::balance($account, $current);
|
||||||
|
$current->addDay();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -133,7 +133,7 @@ class AccountController extends Controller
|
|||||||
$cache->addProperty('single');
|
$cache->addProperty('single');
|
||||||
$cache->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
//return Response::json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->generator->single($account, $start, $end);
|
$data = $this->generator->single($account, $start, $end);
|
||||||
|
Loading…
Reference in New Issue
Block a user