mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -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'])) {
|
if (isset($set['fill'])) {
|
||||||
$currentSet['fill'] = $set['fill'];
|
$currentSet['fill'] = $set['fill'];
|
||||||
}
|
}
|
||||||
|
if (isset($set['currency_symbol'])) {
|
||||||
|
$currentSet['currency_symbol'] = $set['currency_symbol'];
|
||||||
|
}
|
||||||
|
|
||||||
$chartData['datasets'][] = $currentSet;
|
$chartData['datasets'][] = $currentSet;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
@ -501,11 +502,16 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
|
Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
|
||||||
|
|
||||||
|
/** @var CurrencyRepositoryInterface $repository */
|
||||||
|
$repository = app(CurrencyRepositoryInterface::class);
|
||||||
|
|
||||||
$chartData = [];
|
$chartData = [];
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
|
$currency = $repository->find(intval($account->getMeta('currency_id')));
|
||||||
$currentSet = [
|
$currentSet = [
|
||||||
'label' => $account->name,
|
'label' => $account->name,
|
||||||
'entries' => [],
|
'currency_symbol' => $currency->symbol,
|
||||||
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$currentStart = clone $start;
|
$currentStart = clone $start;
|
||||||
$range = Steam::balanceInRange($account, $start, clone $end);
|
$range = Steam::balanceInRange($account, $start, clone $end);
|
||||||
|
@ -42,7 +42,8 @@ var defaultChartOptions = {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
label: function (tooltipItem, data) {
|
label: function (tooltipItem, data) {
|
||||||
"use strict";
|
"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";
|
"use strict";
|
||||||
|
|
||||||
var colorData = true;
|
var colorData = true;
|
||||||
var options = defaultChartOptions;
|
var options = $.extend(true, {}, defaultChartOptions);
|
||||||
options.scales.yAxes = [
|
options.scales.yAxes = [
|
||||||
// y axis 0:
|
// y axis 0:
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ function doubleYNonStackedChart(URI, container) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var colorData = true;
|
var colorData = true;
|
||||||
var options = defaultChartOptions;
|
var options = $.extend(true, {}, defaultChartOptions);
|
||||||
options.scales.yAxes = [
|
options.scales.yAxes = [
|
||||||
// y axis 0:
|
// y axis 0:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user