2016-12-10 06:50:13 +01:00
|
|
|
/*
|
|
|
|
|
* month.js
|
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
|
*
|
|
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
|
*
|
|
|
|
|
* See the LICENSE file for details.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-01-02 10:34:01 +01:00
|
|
|
/** global: budgetExpenseUri, accountExpenseUri, mainUri */
|
2016-12-10 06:50:13 +01:00
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
|
"use strict";
|
|
|
|
|
drawChart();
|
|
|
|
|
|
|
|
|
|
$('#budgets-out-pie-chart-checked').on('change', function () {
|
2016-12-16 08:07:31 +01:00
|
|
|
redrawPieChart('budgets-out-pie-chart', budgetExpenseUri);
|
2016-12-10 06:50:13 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#accounts-out-pie-chart-checked').on('change', function () {
|
|
|
|
|
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function drawChart() {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
// month view:
|
2016-12-23 18:34:58 +01:00
|
|
|
doubleYNonStackedChart(mainUri, 'in-out-chart');
|
2016-12-10 06:50:13 +01:00
|
|
|
|
|
|
|
|
// draw pie chart of income, depending on "show other transactions too":
|
2016-12-16 08:07:31 +01:00
|
|
|
redrawPieChart('budgets-out-pie-chart', budgetExpenseUri);
|
2016-12-10 06:50:13 +01:00
|
|
|
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function redrawPieChart(container, uri) {
|
|
|
|
|
"use strict";
|
|
|
|
|
var checkbox = $('#' + container + '-checked');
|
|
|
|
|
|
|
|
|
|
var others = '0';
|
|
|
|
|
// check if box is checked:
|
|
|
|
|
if (checkbox.prop('checked')) {
|
|
|
|
|
others = '1';
|
|
|
|
|
}
|
|
|
|
|
uri = uri.replace('OTHERS', others);
|
|
|
|
|
|
|
|
|
|
pieChart(uri, container);
|
|
|
|
|
|
|
|
|
|
}
|