mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
Fix for #1518
This commit is contained in:
@@ -90,7 +90,9 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
if (isset($set['currency_symbol'])) {
|
||||
$currentSet['currency_symbol'] = $set['currency_symbol'];
|
||||
}
|
||||
|
||||
if(isset($set['backgroundColor'])) {
|
||||
$currentSet['backgroundColor'] = $set['backgroundColor'];
|
||||
}
|
||||
$chartData['datasets'][] = $currentSet;
|
||||
}
|
||||
|
||||
|
@@ -112,14 +112,16 @@ class ReportController extends Controller
|
||||
$source = $this->getChartData($accounts, $start, $end);
|
||||
$chartData = [
|
||||
[
|
||||
'label' => trans('firefly.income'),
|
||||
'type' => 'bar',
|
||||
'entries' => [],
|
||||
'label' => trans('firefly.income'),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||
'entries' => [],
|
||||
],
|
||||
[
|
||||
'label' => trans('firefly.expenses'),
|
||||
'type' => 'bar',
|
||||
'entries' => [],
|
||||
'label' => trans('firefly.expenses'),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||
'entries' => [],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -189,17 +191,19 @@ class ReportController extends Controller
|
||||
|
||||
$chartData = [
|
||||
[
|
||||
'label' => (string)trans('firefly.income'),
|
||||
'type' => 'bar',
|
||||
'entries' => [
|
||||
'label' => (string)trans('firefly.income'),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
|
||||
'entries' => [
|
||||
(string)trans('firefly.sum_of_period') => $numbers['sum_earned'],
|
||||
(string)trans('firefly.average_in_period') => $numbers['avg_earned'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => trans('firefly.expenses'),
|
||||
'type' => 'bar',
|
||||
'entries' => [
|
||||
'label' => trans('firefly.expenses'),
|
||||
'type' => 'bar',
|
||||
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
|
||||
'entries' => [
|
||||
(string)trans('firefly.sum_of_period') => $numbers['sum_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 = [
|
||||
[53, 124, 165],
|
||||
[0, 141, 76],
|
||||
[0, 141, 76], // green
|
||||
[219, 139, 11],
|
||||
[202, 25, 90],
|
||||
[202, 25, 90], // paars rood-ish #CA195A
|
||||
[85, 82, 153],
|
||||
[66, 133, 244],
|
||||
[219, 68, 55],
|
||||
[219, 68, 55], // red #DB4437
|
||||
[244, 180, 0],
|
||||
[15, 157, 88],
|
||||
[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
|
||||
|
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 () {
|
||||
"use strict";
|
||||
lineChart(netWorthUri, 'net-worth');
|
||||
columnChart(opChartUri, 'income-expenses-chart');
|
||||
columnChart(sumChartUri, 'income-expenses-sum-chart');
|
||||
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||
|
||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||
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 () {
|
||||
"use strict";
|
||||
lineChart(netWorthUri, 'net-worth');
|
||||
columnChart(opChartUri, 'income-expenses-chart');
|
||||
columnChart(sumChartUri, 'income-expenses-sum-chart');
|
||||
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||
|
||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
||||
|
Reference in New Issue
Block a user