mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-21 11:45:14 +00:00
Fix for #1518
This commit is contained in:
@@ -90,7 +90,9 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
if (isset($set['currency_symbol'])) {
|
if (isset($set['currency_symbol'])) {
|
||||||
$currentSet['currency_symbol'] = $set['currency_symbol'];
|
$currentSet['currency_symbol'] = $set['currency_symbol'];
|
||||||
}
|
}
|
||||||
|
if(isset($set['backgroundColor'])) {
|
||||||
|
$currentSet['backgroundColor'] = $set['backgroundColor'];
|
||||||
|
}
|
||||||
$chartData['datasets'][] = $currentSet;
|
$chartData['datasets'][] = $currentSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -112,14 +112,16 @@ class ReportController extends Controller
|
|||||||
$source = $this->getChartData($accounts, $start, $end);
|
$source = $this->getChartData($accounts, $start, $end);
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => trans('firefly.income'),
|
'label' => trans('firefly.income'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [],
|
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||||
|
'entries' => [],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => trans('firefly.expenses'),
|
'label' => trans('firefly.expenses'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [],
|
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||||
|
'entries' => [],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -189,17 +191,19 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
$chartData = [
|
$chartData = [
|
||||||
[
|
[
|
||||||
'label' => (string)trans('firefly.income'),
|
'label' => (string)trans('firefly.income'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [
|
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||||
|
'entries' => [
|
||||||
(string)trans('firefly.sum_of_period') => $numbers['sum_earned'],
|
(string)trans('firefly.sum_of_period') => $numbers['sum_earned'],
|
||||||
(string)trans('firefly.average_in_period') => $numbers['avg_earned'],
|
(string)trans('firefly.average_in_period') => $numbers['avg_earned'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'label' => trans('firefly.expenses'),
|
'label' => trans('firefly.expenses'),
|
||||||
'type' => 'bar',
|
'type' => 'bar',
|
||||||
'entries' => [
|
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||||
|
'entries' => [
|
||||||
(string)trans('firefly.sum_of_period') => $numbers['sum_spent'],
|
(string)trans('firefly.sum_of_period') => $numbers['sum_spent'],
|
||||||
(string)trans('firefly.average_in_period') => $numbers['avg_spent'],
|
(string)trans('firefly.average_in_period') => $numbers['avg_spent'],
|
||||||
],
|
],
|
||||||
|
21
public/js/ff/charts.js
vendored
21
public/js/ff/charts.js
vendored
@@ -26,12 +26,12 @@ var allCharts = {};
|
|||||||
*/
|
*/
|
||||||
var colourSet = [
|
var colourSet = [
|
||||||
[53, 124, 165],
|
[53, 124, 165],
|
||||||
[0, 141, 76],
|
[0, 141, 76], // green
|
||||||
[219, 139, 11],
|
[219, 139, 11],
|
||||||
[202, 25, 90],
|
[202, 25, 90], // paars rood-ish #CA195A
|
||||||
[85, 82, 153],
|
[85, 82, 153],
|
||||||
[66, 133, 244],
|
[66, 133, 244],
|
||||||
[219, 68, 55],
|
[219, 68, 55], // red #DB4437
|
||||||
[244, 180, 0],
|
[244, 180, 0],
|
||||||
[15, 157, 88],
|
[15, 157, 88],
|
||||||
[171, 71, 188],
|
[171, 71, 188],
|
||||||
@@ -205,6 +205,21 @@ function columnChart(URI, container) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param URI
|
||||||
|
* @param container
|
||||||
|
*/
|
||||||
|
function columnChartCustomColours(URI, container) {
|
||||||
|
"use strict";
|
||||||
|
var colorData = false;
|
||||||
|
var options = $.extend(true, {}, defaultChartOptions);
|
||||||
|
var chartType = 'bar';
|
||||||
|
|
||||||
|
drawAChart(URI, container, chartType, options, colorData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param URI
|
* @param URI
|
||||||
|
4
public/js/ff/reports/default/multi-year.js
vendored
4
public/js/ff/reports/default/multi-year.js
vendored
@@ -23,8 +23,8 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
lineChart(netWorthUri, 'net-worth');
|
lineChart(netWorthUri, 'net-worth');
|
||||||
columnChart(opChartUri, 'income-expenses-chart');
|
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||||
columnChart(sumChartUri, 'income-expenses-sum-chart');
|
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||||
|
|
||||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||||
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
||||||
|
4
public/js/ff/reports/default/year.js
vendored
4
public/js/ff/reports/default/year.js
vendored
@@ -23,8 +23,8 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
lineChart(netWorthUri, 'net-worth');
|
lineChart(netWorthUri, 'net-worth');
|
||||||
columnChart(opChartUri, 'income-expenses-chart');
|
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||||
columnChart(sumChartUri, 'income-expenses-sum-chart');
|
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||||
|
|
||||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||||
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
||||||
|
Reference in New Issue
Block a user