mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Cleanup and prep-work for new charts (will be a new feature).
This commit is contained in:
parent
4533b46436
commit
a0afa25145
@ -111,7 +111,8 @@ class AccountController extends BaseController
|
|||||||
return Response::jsoN($return);
|
return Response::jsoN($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transactions(Account $account) {
|
public function transactions(Account $account)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* TODO get the JSON helper to get transactions or something.
|
* TODO get the JSON helper to get transactions or something.
|
||||||
*/
|
*/
|
||||||
@ -123,7 +124,7 @@ class AccountController extends BaseController
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\View\View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function sankey($account)
|
public function sankeyOut($account)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -162,7 +163,7 @@ class AccountController extends BaseController
|
|||||||
$from = $to;
|
$from = $to;
|
||||||
$category = $entry->categories()->first();
|
$category = $entry->categories()->first();
|
||||||
if ($category) {
|
if ($category) {
|
||||||
$to = $category->name . ' (cat)';
|
$to = ' ' . $category->name;
|
||||||
} else {
|
} else {
|
||||||
$to = '(no category)';
|
$to = '(no category)';
|
||||||
}
|
}
|
||||||
@ -211,16 +212,18 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ksort($filtered);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collect amounts to give the labels the proper
|
* Take out the keys:
|
||||||
*/
|
*/
|
||||||
|
foreach ($filtered as $key => $entry) {
|
||||||
|
$result[] = [$entry['from'],$entry['to'],$entry['amount']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop it again to add the amounts.
|
* Loop it again to add the amounts.
|
||||||
*/
|
*/
|
||||||
return View::make('accounts.sankey', compact('filtered'));
|
return Response::json($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ Route::group(['before' => 'auth'], function () {
|
|||||||
Route::get('/accounts/edit/{account}',['uses' => 'AccountController@edit','as' => 'accounts.edit']);
|
Route::get('/accounts/edit/{account}',['uses' => 'AccountController@edit','as' => 'accounts.edit']);
|
||||||
Route::get('/accounts/delete/{account}',['uses' => 'AccountController@delete','as' => 'accounts.delete']);
|
Route::get('/accounts/delete/{account}',['uses' => 'AccountController@delete','as' => 'accounts.delete']);
|
||||||
Route::get('/accounts/show/{account}',['uses' => 'AccountController@show','as' => 'accounts.show']);
|
Route::get('/accounts/show/{account}',['uses' => 'AccountController@show','as' => 'accounts.show']);
|
||||||
Route::get('/accounts/sankey/{account}',['uses' => 'AccountController@sankey','as' => 'accounts.sankey']);
|
Route::get('/accounts/sankey/{account}/out',['uses' => 'AccountController@sankeyOut','as' => 'accounts.sankey.out']);
|
||||||
|
|
||||||
// budget controller:
|
// budget controller:
|
||||||
Route::get('/budgets/date',['uses' => 'BudgetController@indexByDate','as' => 'budgets.index.date']);
|
Route::get('/budgets/date',['uses' => 'BudgetController@indexByDate','as' => 'budgets.index.date']);
|
||||||
|
@ -29,12 +29,10 @@ google.setOnLoadCallback(drawChart);
|
|||||||
|
|
||||||
// Set chart options
|
// Set chart options
|
||||||
var options = {
|
var options = {
|
||||||
width: 600,
|
|
||||||
|
|
||||||
sankey: {
|
sankey: {
|
||||||
link: { color: { fill: '#9fa8da', fillOpacity: 0.8 } },
|
link: { color: { fill: '#9fa8da', fillOpacity: 0.8 } },
|
||||||
node: { color: { fill: '#a61d4c' },
|
node: { color: { fill: '#000' },
|
||||||
label: { color: '#871b47' } }
|
label: { color: '#000' } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<i class="fa fa-fw {{$subTitleIcon}} fa-fw"></i> {{{$account->name}}}
|
<i class="fa fa-fw {{$subTitleIcon}} fa-fw"></i> {{{$account->name}}}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="accountTransactionsTable"></div>
|
<div id="overviewChart"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,11 +61,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Out
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="accountOutSankey"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-12 col-sm-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
In
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<i class="fa fa-repeat fa-fw"></i> Transaction
|
<i class="fa fa-repeat fa-fw"></i> Transactions
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
@ -122,18 +147,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<i class="fa fa-repeat fa-fw"></i> Transaction
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{--
|
{{--
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -153,12 +167,9 @@
|
|||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var accountID = {{{$account->id}}};
|
var accountID = {{{$account->id}}};
|
||||||
var URL = 'bla bla bla';
|
|
||||||
var container = 'transactionByAccountTable';
|
|
||||||
</script>
|
</script>
|
||||||
{{HTML::script('assets/javascript/datatables/jquery.dataTables.min.js')}}
|
{{HTML::script('assets/javascript/datatables/jquery.dataTables.min.js')}}
|
||||||
{{HTML::script('assets/javascript/datatables/dataTables.bootstrap.js')}}
|
{{HTML::script('assets/javascript/datatables/dataTables.bootstrap.js')}}
|
||||||
{{HTML::script('assets/javascript/datatables/transactions.js')}}
|
|
||||||
{{HTML::script('assets/javascript/highcharts/highcharts.js')}}
|
{{HTML::script('assets/javascript/highcharts/highcharts.js')}}
|
||||||
{{HTML::script('assets/javascript/firefly/accounts.js')}}
|
{{HTML::script('assets/javascript/firefly/accounts.js')}}
|
||||||
@stop
|
@stop
|
@ -2,12 +2,10 @@ $(function () {
|
|||||||
if ($('#accountTable').length == 1) {
|
if ($('#accountTable').length == 1) {
|
||||||
drawDatatable();
|
drawDatatable();
|
||||||
}
|
}
|
||||||
//if ($('#accountTransactionsTable').length == 1) {
|
if ($('#overviewChart').length == 1) {
|
||||||
// drawTransactionsForAccount();
|
drawOverviewChart();
|
||||||
//}
|
|
||||||
if ($('#transactionByAccountTable').length == 1) {
|
|
||||||
renderTransactionsFromURL(URL, container);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function drawDatatable() {
|
function drawDatatable() {
|
||||||
@ -62,11 +60,11 @@ function drawDatatable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function drawTransactionsForAccount() {
|
function drawOverviewChart() {
|
||||||
$.getJSON('chart/home/account/' + accountID).success(function (data) {
|
$.getJSON('chart/home/account/' + accountID).success(function (data) {
|
||||||
var options = {
|
var options = {
|
||||||
chart: {
|
chart: {
|
||||||
renderTo: 'accountTransactionsTable',
|
renderTo: 'overviewChart',
|
||||||
type: 'spline'
|
type: 'spline'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -128,84 +126,6 @@ function drawTransactionsForAccount() {
|
|||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$('#accountTransactionsTable').highcharts(options);
|
$('#overviewChart').highcharts(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//$(function () {
|
|
||||||
//if($('#chart').length == 1) {
|
|
||||||
// /**
|
|
||||||
// * get data from controller for home charts:
|
|
||||||
// */
|
|
||||||
// $.getJSON('chart/home/account/' + accountID).success(function (data) {
|
|
||||||
// var options = {
|
|
||||||
// chart: {
|
|
||||||
// renderTo: 'chart',
|
|
||||||
// type: 'spline'
|
|
||||||
// },
|
|
||||||
//
|
|
||||||
// series: data.series,
|
|
||||||
// title: {
|
|
||||||
// text: null
|
|
||||||
// },
|
|
||||||
// yAxis: {
|
|
||||||
// allowDecimals: false,
|
|
||||||
// labels: {
|
|
||||||
// formatter: function () {
|
|
||||||
// if(this.value >= 1000 || this.value <= -1000) {
|
|
||||||
// return '\u20AC ' + (this.value / 1000) + 'k';
|
|
||||||
// }
|
|
||||||
// return '\u20AC ' + this.value;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// title: {text: null}
|
|
||||||
// },
|
|
||||||
// xAxis: {
|
|
||||||
// type: 'datetime',
|
|
||||||
// dateTimeLabelFormats: {
|
|
||||||
// day: '%e %b',
|
|
||||||
// week: '%e %b'
|
|
||||||
// },
|
|
||||||
// title: {
|
|
||||||
// text: null
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// legend: {enabled:false},
|
|
||||||
// tooltip: {
|
|
||||||
// formatter: function () {
|
|
||||||
// return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// plotOptions: {
|
|
||||||
// line: {
|
|
||||||
// shadow: true
|
|
||||||
// },
|
|
||||||
// series: {
|
|
||||||
// cursor: 'pointer',
|
|
||||||
// negativeColor: '#FF0000',
|
|
||||||
// threshold: 0,
|
|
||||||
// lineWidth: 1,
|
|
||||||
// marker: {
|
|
||||||
// radius: 0
|
|
||||||
// },
|
|
||||||
// point: {
|
|
||||||
// events: {
|
|
||||||
// click: function (e) {
|
|
||||||
// alert('click!');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// credits: {
|
|
||||||
// enabled: false
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// $('#chart').highcharts(options);
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//});
|
|
Loading…
Reference in New Issue
Block a user