A new chart, single count.

This commit is contained in:
James Cole 2015-06-27 17:38:16 +02:00
parent 4cceb3ddaa
commit 48624d0a34
2 changed files with 26 additions and 3 deletions

View File

@ -85,7 +85,30 @@ class ChartJsAccountChartGenerator implements AccountChartGenerator
*/
public function single(Account $account, Carbon $start, Carbon $end)
{
// TODO: Implement single() method.
//throw new NotImplementedException;
// language:
$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;
}
}

View File

@ -133,7 +133,7 @@ class AccountController extends Controller
$cache->addProperty('single');
$cache->addProperty($account->id);
if ($cache->has()) {
return Response::json($cache->get()); // @codeCoverageIgnore
//return Response::json($cache->get()); // @codeCoverageIgnore
}
$data = $this->generator->single($account, $start, $end);