mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 04:19:12 +00:00
Fixes all charts in future category report.
This commit is contained in:
@@ -8,11 +8,33 @@
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
// it's hard coded, but what you're gonna do?
|
||||
var catInUri = 'chart/category/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/OTHERS/income';
|
||||
var catOutUri = 'chart/category/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/OTHERS/expense';
|
||||
var accInUri = 'chart/account/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/OTHERS/income';
|
||||
var accOutUri = 'chart/account/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/OTHERS/expense';
|
||||
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
drawChart();
|
||||
$('#categories-in-pie-chart-checked').on('change', redrawCatInPie);
|
||||
$('#categories-out-pie-chart-checked').on('change', redrawCatOutPie);
|
||||
|
||||
$('#categories-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('categories-in-pie-chart', catInUri);
|
||||
});
|
||||
|
||||
$('#categories-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('categories-out-pie-chart', catOutUri);
|
||||
});
|
||||
|
||||
$('#accounts-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-in-pie-chart', accInUri);
|
||||
});
|
||||
|
||||
$('#accounts-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-out-pie-chart', accOutUri);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -22,36 +44,24 @@ function drawChart() {
|
||||
// month view:
|
||||
|
||||
// draw pie chart of income, depending on "show other transactions too":
|
||||
redrawCatInPie();
|
||||
redrawCatOutPie();
|
||||
redrawPieChart('categories-in-pie-chart', catInUri);
|
||||
redrawPieChart('categories-out-pie-chart', catOutUri);
|
||||
redrawPieChart('accounts-in-pie-chart', accInUri);
|
||||
redrawPieChart('accounts-out-pie-chart', accOutUri);
|
||||
}
|
||||
|
||||
function redrawCatOutPie() {
|
||||
function redrawPieChart(container, uri) {
|
||||
"use strict";
|
||||
var checkbox = $('#categories-out-pie-chart-checked');
|
||||
var container = 'categories-out-pie-chart';
|
||||
var checkbox = $('#' + container + '-checked');
|
||||
|
||||
//
|
||||
var others = '0';
|
||||
// check if box is checked:
|
||||
if (checkbox.prop('checked')) {
|
||||
others = '1';
|
||||
}
|
||||
uri = uri.replace('OTHERS', others);
|
||||
console.log('URI for ' + container + ' is ' + uri);
|
||||
|
||||
pieChart(uri, container);
|
||||
|
||||
pieChart('chart/category/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/' + others + '/expense', container);
|
||||
}
|
||||
|
||||
function redrawCatInPie() {
|
||||
"use strict";
|
||||
var checkbox = $('#categories-in-pie-chart-checked');
|
||||
var container = 'categories-in-pie-chart';
|
||||
|
||||
//
|
||||
var others = '0';
|
||||
// check if box is checked:
|
||||
if (checkbox.prop('checked')) {
|
||||
others = '1';
|
||||
}
|
||||
|
||||
pieChart('chart/category/' + accountIds + '/' + categoryIds + '/' + startDate + '/' + endDate + '/' + others + '/income', container);
|
||||
}
|
||||
Reference in New Issue
Block a user