mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
More chart optimisations.
This commit is contained in:
@@ -39,12 +39,11 @@ interface BudgetChartGeneratorInterface
|
||||
public function frontpage(Collection $entries): array;
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
* @param string $viewRange
|
||||
* @param array $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function period(Collection $entries, string $viewRange) : array;
|
||||
public function period(array $entries) : array;
|
||||
|
||||
/**
|
||||
* @param Collection $budgets
|
||||
|
@@ -101,15 +101,15 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
* @param string $viewRange
|
||||
* @param array $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function period(Collection $entries, string $viewRange) : array
|
||||
public function period(array $entries) : array
|
||||
{
|
||||
|
||||
$data = [
|
||||
'labels' => [],
|
||||
'labels' => array_keys($entries),
|
||||
'datasets' => [
|
||||
0 => [
|
||||
'label' => trans('firefly.budgeted'),
|
||||
@@ -122,9 +122,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
||||
],
|
||||
'count' => 2,
|
||||
];
|
||||
foreach ($entries as $entry) {
|
||||
$label = Navigation::periodShow($entry['date'], $viewRange);
|
||||
$data['labels'][] = $label;
|
||||
|
||||
foreach ($entries as $label => $entry) {
|
||||
// data set 0 is budgeted
|
||||
// data set 1 is spent:
|
||||
$data['datasets'][0]['data'][] = $entry['budgeted'];
|
||||
|
Reference in New Issue
Block a user