mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Make some charts multi-currency.
This commit is contained in:
14
public/js/ff/charts.defaults.js
vendored
14
public/js/ff/charts.defaults.js
vendored
@@ -117,6 +117,20 @@ var defaultChartOptions = {
|
||||
}
|
||||
};
|
||||
|
||||
var pieOptionsWithCurrency = {
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
label: function (tooltipItem, data) {
|
||||
"use strict";
|
||||
var value = data.datasets[0].data[tooltipItem.index];
|
||||
return data.labels[tooltipItem.index] + ': ' + accounting.formatMoney(value, data.datasets[tooltipItem.datasetIndex].currency_symbol[tooltipItem.index]);
|
||||
}
|
||||
}
|
||||
},
|
||||
maintainAspectRatio: true,
|
||||
responsive: true
|
||||
};
|
||||
|
||||
var defaultPieOptions = {
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
|
17
public/js/ff/charts.js
vendored
17
public/js/ff/charts.js
vendored
@@ -257,6 +257,23 @@ function pieChart(URI, container) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param URI
|
||||
* @param container
|
||||
*/
|
||||
function multiCurrencyPieChart(URI, container) {
|
||||
"use strict";
|
||||
|
||||
var colorData = false;
|
||||
var options = $.extend(true, {}, pieOptionsWithCurrency);
|
||||
var chartType = 'pie';
|
||||
|
||||
drawAChart(URI, container, chartType, options, colorData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param URI
|
||||
|
2
public/js/ff/index.js
vendored
2
public/js/ff/index.js
vendored
@@ -32,7 +32,7 @@ function drawChart() {
|
||||
lineChart(accountFrontpageUri, 'accounts-chart');
|
||||
|
||||
if (billCount > 0) {
|
||||
pieChart('chart/bill/frontpage', 'bills-chart');
|
||||
multiCurrencyPieChart('chart/bill/frontpage', 'bills-chart');
|
||||
}
|
||||
stackedColumnChart('chart/budget/frontpage', 'budgets-chart');
|
||||
columnChart('chart/category/frontpage', 'categories-chart');
|
||||
|
Reference in New Issue
Block a user