mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Refactor some JS functions.
This commit is contained in:
parent
74664afa68
commit
8273f467b6
@ -75,7 +75,7 @@ function lineChart(URI, container) {
|
||||
"use strict";
|
||||
|
||||
var colorData = true;
|
||||
var options = defaultChartOptions;
|
||||
var options = $.extend(true, {}, defaultChartOptions);
|
||||
var chartType = 'line';
|
||||
|
||||
drawAChart(URI, container, chartType, options, colorData);
|
||||
@ -188,7 +188,7 @@ function columnChart(URI, container) {
|
||||
"use strict";
|
||||
console.log('Going to draw column chart for ' + URI + ' in ' + container);
|
||||
var colorData = true;
|
||||
var options = defaultChartOptions;
|
||||
var options = $.extend(true, {}, defaultChartOptions);
|
||||
var chartType = 'bar';
|
||||
|
||||
drawAChart(URI, container, chartType, options, colorData);
|
||||
@ -224,7 +224,7 @@ function pieChart(URI, container) {
|
||||
"use strict";
|
||||
|
||||
var colorData = false;
|
||||
var options = defaultPieOptions;
|
||||
var options = $.extend(true, {}, defaultPieOptions);
|
||||
var chartType = 'pie';
|
||||
|
||||
drawAChart(URI, container, chartType, options, colorData);
|
||||
|
@ -15,19 +15,19 @@ $(function () {
|
||||
drawChart();
|
||||
|
||||
$('#categories-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('categories-in-pie-chart', categoryIncomeUri);
|
||||
redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
|
||||
});
|
||||
|
||||
$('#categories-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('categories-out-pie-chart', categoryExpenseUri);
|
||||
redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
|
||||
});
|
||||
|
||||
$('#accounts-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
|
||||
redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
|
||||
});
|
||||
|
||||
$('#accounts-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
|
||||
});
|
||||
|
||||
});
|
||||
@ -40,15 +40,17 @@ function drawChart() {
|
||||
doubleYChart(mainUri, 'in-out-chart');
|
||||
|
||||
// draw pie chart of income, depending on "show other transactions too":
|
||||
redrawPieChart('categories-in-pie-chart', categoryIncomeUri);
|
||||
redrawPieChart('categories-out-pie-chart', categoryExpenseUri);
|
||||
redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
|
||||
redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
|
||||
redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
|
||||
redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
|
||||
|
||||
stackedColumnChart(expenseAccountTimeUri, 'expense-time-chart');
|
||||
stackedColumnChart(revenueAccountTimeUri, 'revenue-time-chart');
|
||||
|
||||
}
|
||||
|
||||
function redrawPieChart(container, uri) {
|
||||
function redrawPieChart(uri, container) {
|
||||
"use strict";
|
||||
var checkbox = $('#' + container + '-checked');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user