From eebac2a66dbcfb458f0577557da9f38c92bed1ef Mon Sep 17 00:00:00 2001
From: James Cole
+ I want to do this I already did this Not this time diff --git a/bootstrap/start.php b/bootstrap/start.php index 45ff16c5da..0881f3fc03 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -93,7 +93,7 @@ Event::subscribe('FireflyIII\Event\Budget'); // TODO event that creates a relationship between transaction journals and recurring events when created. // TODO event that updates the relationship between transaction journals and recurring events when edited. -// TODO event that creates a LimitRepetition when a Limit is created. +// event that creates a LimitRepetition when a Limit is created. // event for when a transfer gets created and set an associated piggy bank; save as Piggy bank event. // when this transfer gets edited, retro-actively edit the event and THUS also the piggy bank. // event for when a transfer gets deleted; also delete related piggy bank event. @@ -105,4 +105,9 @@ Event::subscribe('FireflyIII\Event\Budget'); // TODO think about reminders. // TODO an event that triggers and creates a limit + limit repetition when a budget is created, or something? // TODO has many through needs to be added wherever relevant. Account > journals, etc. +// TODO check all models for "external" methods once more. +// TODO Auth::user() should be used very sparsely. +// TODO direct calls to models are BAD +// TODO cleanup everything related to reminders because it still feels a bit sloppy. +// TODO use a Database\Reminder thing instead of self-made ORM. return $app; diff --git a/public/assets/javascript/firefly/gcharts.js b/public/assets/javascript/firefly/gcharts.js index f11341d821..3636599c68 100644 --- a/public/assets/javascript/firefly/gcharts.js +++ b/public/assets/javascript/firefly/gcharts.js @@ -1,5 +1,8 @@ google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'sankey', 'table']}); +/* +TODO manage the combination of default options AND custom options. + */ function googleLineChart(URL, container) { if ($('#' + container).length == 1) { $.getJSON(URL).success(function (data) { @@ -150,6 +153,43 @@ function googleStackedColumnChart(URL, container) { } } +function googleComboChart(URL, container) { + if ($('#' + container).length == 1) { + $.getJSON(URL).success(function (data) { + /* + Get the data from the JSON + */ + gdata = new google.visualization.DataTable(data); + + /* + Format as money + */ + var money = new google.visualization.NumberFormat({ + decimalSymbol: ',', + groupingSymbol: '.', + prefix: '\u20AC ' + }); + for (i = 1; i < gdata.getNumberOfColumns(); i++) { + money.format(gdata, i); + } + + /* + Create a new google charts object. + */ + var chart = new google.visualization.ComboChart(document.getElementById(container)); + /* + Draw it: + */ + chart.draw(gdata, defaultComboChartOptions); + + }).fail(function () { + $('#' + container).addClass('google-chart-error'); + }); + } else { + console.log('No container found called "' + container + '"'); + } +} + function googlePieChart(URL, container) { if ($('#' + container).length == 1) { $.getJSON(URL).success(function (data) { diff --git a/public/assets/javascript/firefly/gcharts.options.js b/public/assets/javascript/firefly/gcharts.options.js index e4d983a85b..dc18206bd1 100644 --- a/public/assets/javascript/firefly/gcharts.options.js +++ b/public/assets/javascript/firefly/gcharts.options.js @@ -51,6 +51,29 @@ var defaultBarChartOptions = { }, }; +var defaultComboChartOptions = { + height: 300, + chartArea: { + left: 75, + top: 10, + width: '100%', + height: '90%' + }, + vAxis: { + minValue: 0, + format: '\u20AC #' + }, + legend: { + position: 'none' + }, + series: { + 0: {type: 'line'}, + 1: {type: 'line'}, + 2: {type: 'bars'} + }, + bar: {groupWidth: 20} +}; + var defaultColumnChartOptions = { height: 400, chartArea: { diff --git a/public/assets/javascript/firefly/recurring.js b/public/assets/javascript/firefly/recurring.js index 177dada460..b0857f6629 100644 --- a/public/assets/javascript/firefly/recurring.js +++ b/public/assets/javascript/firefly/recurring.js @@ -7,8 +7,8 @@ $(document).ready(function () { googleTable('table/recurring/' + recurringID + '/transactions', 'transaction-table'); } } - if (typeof(googleLineChart) == 'function' && typeof(recurringID) != 'undefined') { - googleLineChart('chart/recurring/' + recurringID, 'recurring-overview'); + if (typeof(googleComboChart) == 'function' && typeof(recurringID) != 'undefined') { + googleComboChart('chart/recurring/' + recurringID, 'recurring-overview'); } } ); \ No newline at end of file