mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-01 11:47:14 -06:00
Account chart can display multiple currencies.
This commit is contained in:
parent
c7984d4363
commit
209a907c61
@ -81,6 +81,9 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
if (isset($set['fill'])) {
|
||||
$currentSet['fill'] = $set['fill'];
|
||||
}
|
||||
if (isset($set['currency_symbol'])) {
|
||||
$currentSet['currency_symbol'] = $set['currency_symbol'];
|
||||
}
|
||||
|
||||
$chartData['datasets'][] = $currentSet;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
@ -501,11 +502,16 @@ class AccountController extends Controller
|
||||
}
|
||||
Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
|
||||
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
$chartData = [];
|
||||
foreach ($accounts as $account) {
|
||||
$currency = $repository->find(intval($account->getMeta('currency_id')));
|
||||
$currentSet = [
|
||||
'label' => $account->name,
|
||||
'entries' => [],
|
||||
'label' => $account->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'entries' => [],
|
||||
];
|
||||
$currentStart = clone $start;
|
||||
$range = Steam::balanceInRange($account, $start, clone $end);
|
||||
|
@ -42,7 +42,8 @@ var defaultChartOptions = {
|
||||
callbacks: {
|
||||
label: function (tooltipItem, data) {
|
||||
"use strict";
|
||||
return data.datasets[tooltipItem.datasetIndex].label + ': ' + accounting.formatMoney(tooltipItem.yLabel);
|
||||
return data.datasets[tooltipItem.datasetIndex].label + ': ' +
|
||||
accounting.formatMoney(tooltipItem.yLabel, data.datasets[tooltipItem.datasetIndex].currency_symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ function doubleYChart(URI, container) {
|
||||
"use strict";
|
||||
|
||||
var colorData = true;
|
||||
var options = defaultChartOptions;
|
||||
var options = $.extend(true, {}, defaultChartOptions);
|
||||
options.scales.yAxes = [
|
||||
// y axis 0:
|
||||
{
|
||||
@ -141,7 +141,7 @@ function doubleYNonStackedChart(URI, container) {
|
||||
"use strict";
|
||||
|
||||
var colorData = true;
|
||||
var options = defaultChartOptions;
|
||||
var options = $.extend(true, {}, defaultChartOptions);
|
||||
options.scales.yAxes = [
|
||||
// y axis 0:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user