Skip to content

Firefly III: a personal finances manager

Fixed lots of chart references.

James Coled22a6c019cd5
diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php
index 17b3157e87..f4570c3d5a 100644
--- a/app/Http/Controllers/Chart/BillController.php
+++ b/app/Http/Controllers/Chart/BillController.php
@@ -31,7 +31,7 @@ class BillController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function bill(GChart $chart, BillRepositoryInterface $repository, Bill $bill)
+ public function single(GChart $chart, BillRepositoryInterface $repository, Bill $bill)
{
$chart->addColumn(trans('firefly.date'), 'date');
@@ -62,7 +62,7 @@ class BillController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function bills(GChart $chart, BillRepositoryInterface $repository, AccountRepositoryInterface $accounts)
+ public function frontpage(GChart $chart, BillRepositoryInterface $repository, AccountRepositoryInterface $accounts)
{
$chart->addColumn(trans('firefly.name'), 'string');
$chart->addColumn(trans('firefly.amount'), 'number');
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 7d19b009e9..76d14c3be2 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -27,7 +27,7 @@ class BudgetController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function home(GChart $chart, BudgetRepositoryInterface $repository)
+ public function frontpage(GChart $chart, BudgetRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.budget'), 'string');
$chart->addColumn(trans('firefly.left'), 'number');
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index aa8ae7cbca..aa6b781c1e 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -4,6 +4,7 @@ namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
+use Crypt;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
@@ -14,7 +15,6 @@ use Navigation;
use Preferences;
use Response;
use Session;
-use Crypt;
/**
* Class CategoryController
@@ -33,7 +33,7 @@ class CategoryController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function home(GChart $chart, CategoryRepositoryInterface $repository)
+ public function frontpage(GChart $chart, CategoryRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.category'), 'string');
$chart->addColumn(trans('firefly.spent'), 'number');
@@ -56,34 +56,24 @@ class CategoryController extends Controller
}
/**
- * Show an overview for a category.
- *
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function overview(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
+ public function month(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
- // oldest transaction in category:
- $start = $repository->getFirstActivityDate($category);
-
- $range = Preferences::get('viewRange', '1M')->data;
- // jump to start of week / month / year / etc
- $start = Navigation::startOfPeriod($start, $range);
+ $start = clone Session::get('start', Carbon::now()->startOfMonth());
+ $end = Session::get('end', Carbon::now()->endOfMonth());
$chart->addColumn(trans('firefly.period'), 'date');
$chart->addColumn(trans('firefly.spent'), 'number');
- $end = new Carbon;
while ($start <= $end) {
-
- $currentEnd = Navigation::endOfPeriod($start, $range->data);
- $spent = $repository->spentInPeriod($category, $start, $currentEnd);
+ $spent = $repository->spentOnDaySum($category, $start);
$chart->addRow(clone $start, $spent);
-
- $start = Navigation::addPeriod($start, $range->data, 0);
+ $start->addDay();
}
$chart->generate();
@@ -93,25 +83,35 @@ class CategoryController extends Controller
}
-
/**
+ * Show an overview for a category for all time, per month/week/year.
+ *
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function period(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
+ public function all(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
- $start = clone Session::get('start', Carbon::now()->startOfMonth());
+ // oldest transaction in category:
+ $start = $repository->getFirstActivityDate($category);
+
+ $range = Preferences::get('viewRange', '1M')->data;
+ // jump to start of week / month / year / etc
+ $start = Navigation::startOfPeriod($start, $range);
+
$chart->addColumn(trans('firefly.period'), 'date');
$chart->addColumn(trans('firefly.spent'), 'number');
- $end = Session::get('end', Carbon::now()->endOfMonth());
+ $end = new Carbon;
while ($start <= $end) {
- $spent = $repository->spentOnDaySum($category, $start);
+
+ $currentEnd = Navigation::endOfPeriod($start, $range);
+ $spent = $repository->spentInPeriod($category, $start, $currentEnd);
$chart->addRow(clone $start, $spent);
- $start->addDay();
+
+ $start = Navigation::addPeriod($start, $range, 0);
}
$chart->generate();
@@ -121,7 +121,6 @@ class CategoryController extends Controller
}
-
/**
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php
index 6662c4af9c..d240afa583 100644
--- a/app/Http/Controllers/Chart/PiggyBankController.php
+++ b/app/Http/Controllers/Chart/PiggyBankController.php
@@ -36,7 +36,7 @@ class PiggyBankController extends Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function piggyBankHistory(GChart $chart, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
+ public function history(GChart $chart, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$chart->addColumn(trans('firefly.date'), 'date');
$chart->addColumn(trans('firefly.balance'), 'number');
diff --git a/app/Http/routes.php b/app/Http/routes.php
index b8c22ffce9..9b659f3a69 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -273,27 +273,39 @@ Route::group(
/**
- * Google Chart Controller
+ * ALL CHART Controllers
*/
- Route::get('/chart/account/{account}', ['uses' => 'GoogleChartController@accountBalance']);
+ // accounts:
+ Route::get('/chart/account/frontpage', ['uses' => 'Chart\AccountController@frontpage']);
+ Route::get('/chart/account/{account}', ['uses' => 'Chart\AccountController@single']);
+
+ // bills:
+ Route::get('/chart/bill/frontpage', ['uses' => 'Chart\BillController@frontpage']);
+ Route::get('/chart/bill/{bill}', ['uses' => 'Chart\BillController@single']);
+
+ // budgets:
+ Route::get('/chart/budget/frontpage', ['uses' => 'Chart\BudgetController@frontpage']);
+ Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'Chart\BudgetController@budgetLimit']);
+
+ // categories:
+ Route::get('/chart/category/frontpage', ['uses' => 'Chart\CategoryController@frontpage']);
+ Route::get('/chart/category/{category}/month', ['uses' => 'Chart\CategoryController@month']); // should be period.
+ Route::get('/chart/category/{category}/all', ['uses' => 'Chart\CategoryController@all']);
+
+ // piggy banks:
+ Route::get('/chart/piggyBank/{piggyBank}', ['uses' => 'Chart\PiggyBankController@history']);
- Route::get('/chart/home/account', ['uses' => 'GoogleChartController@allAccountsBalanceChart']);
- Route::get('/chart/home/budgets', ['uses' => 'GoogleChartController@allBudgetsHomeChart']);
- Route::get('/chart/home/categories', ['uses' => 'GoogleChartController@allCategoriesHomeChart']);
- Route::get('/chart/home/bills', ['uses' => 'GoogleChartController@billsOverview']);
- Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']);
Route::get('/chart/reports/income-expenses/{year}/{shared?}', ['uses' => 'GoogleChartController@yearInExp'])->where(
['year' => '[0-9]{4}', 'shared' => 'shared']
);
Route::get('/chart/reports/income-expenses-sum/{year}/{shared?}', ['uses' => 'GoogleChartController@yearInExpSum'])->where(
['year' => '[0-9]{4}', 'shared' => 'shared']
);
- Route::get('/chart/bills/{bill}', ['uses' => 'GoogleChartController@billOverview']);
- Route::get('/chart/piggy-history/{piggyBank}', ['uses' => 'GoogleChartController@piggyBankHistory']);
- Route::get('/chart/category/{category}/period', ['uses' => 'GoogleChartController@categoryPeriodChart']);
- Route::get('/chart/category/{category}/overview', ['uses' => 'GoogleChartController@categoryOverviewChart']);
+
+
+
/**
* Help Controller
diff --git a/public/js/bills.js b/public/js/bills.js
index 0bddb7f3ef..5f45f2a90b 100644
--- a/public/js/bills.js
+++ b/public/js/bills.js
@@ -1,7 +1,7 @@
$(document).ready(function () {
if (typeof(googleComboChart) === 'function' && typeof(billID) !== 'undefined') {
- googleComboChart('chart/bills/' + billID, 'bill-overview');
+ googleComboChart('chart/bill/' + billID, 'bill-overview');
}
}
);
\ No newline at end of file
diff --git a/public/js/categories.js b/public/js/categories.js
index 01c72143d9..d4fb5c692f 100644
--- a/public/js/categories.js
+++ b/public/js/categories.js
@@ -1,8 +1,8 @@
$(function () {
if (typeof categoryID !== 'undefined') {
- googleColumnChart('chart/category/' + categoryID + '/overview', 'componentOverview');
- googleColumnChart('chart/category/' + categoryID + '/period', 'periodOverview');
+ googleColumnChart('chart/category/' + categoryID + '/all', 'all');
+ googleColumnChart('chart/category/' + categoryID + '/month', 'month');
}
diff --git a/public/js/index.js b/public/js/index.js
index 1af5c9199e..ec5579ee23 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2,11 +2,12 @@ google.setOnLoadCallback(drawChart);
function drawChart() {
- googleLineChart('chart/home/account', 'accounts-chart');
- //googleColumnChart('chart/home/budgets', 'budgets-chart');
- googleStackedColumnChart('chart/home/budgets', 'budgets-chart');
- googleColumnChart('chart/home/categories', 'categories-chart');
- googlePieChart('chart/home/bills', 'bills-chart');
+ googleLineChart('chart/account/frontpage', 'accounts-chart');
+ googlePieChart('chart/bill/frontpage', 'bills-chart');
+ googleStackedColumnChart('chart/budget/frontpage', 'budgets-chart');
+ googleColumnChart('chart/category/frontpage', 'categories-chart');
+
+
getBoxAmounts();
}
diff --git a/public/js/piggy-banks.js b/public/js/piggy-banks.js
index 39c4658b24..cefb43d0f6 100644
--- a/public/js/piggy-banks.js
+++ b/public/js/piggy-banks.js
@@ -3,7 +3,7 @@ $(function () {
$('.removeMoney').on('click', removeMoney);
if (typeof(googleLineChart) === 'function' && typeof(piggyBankID) !== 'undefined') {
- googleLineChart('chart/piggy-history/' + piggyBankID, 'piggy-bank-history');
+ googleLineChart('chart/piggyBank/' + piggyBankID, 'piggy-bank-history');
}
$('#sortable tbody').sortable(
diff --git a/resources/twig/categories/show.twig b/resources/twig/categories/show.twig
index 627fafd7a2..d9d647504a 100644
--- a/resources/twig/categories/show.twig
+++ b/resources/twig/categories/show.twig
@@ -6,10 +6,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-calendar fa-fw"></i>
- {{ 'overview'|_ }}
+ {{ 'overview'|_ }} (month)
</div>
<div class="panel-body">
- <div id="periodOverview"></div>
+ <div id="month"></div>
</div>
</div>
</div>
@@ -17,10 +17,10 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-calendar-o fa-fw"></i>
- {{ 'overview'|_ }}
+ {{ 'overview'|_ }} (all)
</div>
<div class="panel-body">
- <div id="componentOverview"></div>
+ <div id="all"></div>
</div>
</div>
</div>