Skip to content

Firefly III: a personal finances manager

Removed old references to Google [skip ci]

James Coleaf7952f2040a
diff --git a/app/Generator/Chart/Account/AccountChartGenerator.php b/app/Generator/Chart/Account/AccountChartGenerator.php
index 8a019d155e..d64876c7d6 100644
--- a/app/Generator/Chart/Account/AccountChartGenerator.php
+++ b/app/Generator/Chart/Account/AccountChartGenerator.php
@@ -40,4 +40,13 @@ interface AccountChartGenerator
* @return array
*/
public function single(Account $account, Carbon $start, Carbon $end);
+
+ /**
+ * @param Collection $accounts
+ * @param Carbon $start
+ * @param Carbon $end
+ *
+ * @return array
+ */
+ public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end);
}
diff --git a/app/Generator/Chart/Account/GoogleAccountChartGenerator.php b/app/Generator/Chart/Account/GoogleAccountChartGenerator.php
deleted file mode 100644
index ab84e168ce..0000000000
--- a/app/Generator/Chart/Account/GoogleAccountChartGenerator.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\Account;
-
-use Carbon\Carbon;
-use FireflyIII\Models\Account;
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-use Steam;
-
-
-/**
- * Class GoogleAccountChartGenerator
- *
- * @package FireflyIII\Generator\Chart\Account
- */
-class GoogleAccountChartGenerator implements AccountChartGenerator
-{
-
-
- /**
- * @param Collection $accounts
- * @param Carbon $start
- * @param Carbon $end
- *
- * @return array
- */
- public function all(Collection $accounts, Carbon $start, Carbon $end)
- {
- // make chart (original code):
- $chart = new GChart;
- $chart->addColumn(trans('firefly.dayOfMonth'), 'date');
- $index = 1;
- /** @var Account $account */
- foreach ($accounts as $account) {
- $chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
- $chart->addCertainty($index);
- $index++;
- }
- $current = clone $start;
- $current->subDay();
- $today = Carbon::now();
- while ($end >= $current) {
- $row = [clone $current];
- $certain = $current < $today;
- foreach ($accounts as $account) {
- $row[] = Steam::balance($account, $current);
- $row[] = $certain;
- }
- $chart->addRowArray($row);
- $current->addDay();
- }
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param Collection $accounts
- * @param Carbon $start
- * @param Carbon $end
- *
- * @return array
- */
- public function frontpage(Collection $accounts, Carbon $start, Carbon $end)
- {
- return $this->all($accounts, $start, $end);
- }
-
- /**
- * @param Account $account
- * @param Carbon $start
- * @param Carbon $end
- *
- * @return array
- */
- public function single(Account $account, Carbon $start, Carbon $end)
- {
- $current = clone $start;
- $today = new Carbon;
- $chart = new GChart;
- $chart->addColumn(trans('firefly.dayOfMonth'), 'date');
- $chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
- $chart->addCertainty(1);
-
- while ($end >= $current) {
- $certain = $current < $today;
- $chart->addRow(clone $current, Steam::balance($account, $current), $certain);
- $current->addDay();
- }
-
-
- $chart->generate();
-
- return $chart->getData();
- }
-}
diff --git a/app/Generator/Chart/Bill/GoogleBillChartGenerator.php b/app/Generator/Chart/Bill/GoogleBillChartGenerator.php
deleted file mode 100644
index 3ccf83d7d5..0000000000
--- a/app/Generator/Chart/Bill/GoogleBillChartGenerator.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\Bill;
-
-use FireflyIII\Models\Bill;
-use FireflyIII\Models\TransactionJournal;
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-
-/**
- * Class GoogleBillChartGenerator
- *
- * @package FireflyIII\Generator\Chart\Bill
- */
-class GoogleBillChartGenerator implements BillChartGenerator
-{
-
-
- /**
- * @param Collection $paid
- * @param Collection $unpaid
- *
- * @return array
- */
- public function frontpage(Collection $paid, Collection $unpaid)
- {
- // loop paid and create single entry:
- $paidDescriptions = [];
- $paidAmount = 0;
- $unpaidDescriptions = [];
- $unpaidAmount = 0;
-
- bcscale(2);
-
-
- /** @var TransactionJournal $entry */
- foreach ($paid as $entry) {
-
- $paidDescriptions[] = $entry->description;
- $paidAmount = bcadd($paidAmount, $entry->amount);
- }
-
- // loop unpaid:
- /** @var Bill $entry */
- foreach ($unpaid as $entry) {
- $description = $entry[0]->name . ' (' . $entry[1]->format('jS M Y') . ')';
- $amount = bcdiv(bcadd($entry[0]->amount_max, $entry[0]->amount_min), 2);
- $unpaidDescriptions[] = $description;
- $unpaidAmount = bcadd($unpaidAmount, $amount);
- unset($amount, $description);
- }
-
- $chart = new GChart;
- $chart->addColumn(trans('firefly.name'), 'string');
- $chart->addColumn(trans('firefly.amount'), 'number');
-
- $chart->addRow(trans('firefly.unpaid') . ': ' . join(', ', $unpaidDescriptions), $unpaidAmount);
- $chart->addRow(trans('firefly.paid') . ': ' . join(', ', $paidDescriptions), $paidAmount);
-
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param Bill $bill
- * @param Collection $entries
- *
- * @return mixed
- */
- public function single(Bill $bill, Collection $entries)
- {
- // make chart:
- $chart = new GChart;
- $chart->addColumn(trans('firefly.date'), 'date');
- $chart->addColumn(trans('firefly.maxAmount'), 'number');
- $chart->addColumn(trans('firefly.minAmount'), 'number');
- $chart->addColumn(trans('firefly.billEntry'), 'number');
-
- /** @var TransactionJournal $result */
- foreach ($entries as $result) {
- $chart->addRow(
- clone $result->date,
- round($bill->amount_max, 2),
- round($bill->amount_min, 2),
- round($result->amount, 2)
- );
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-}
diff --git a/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php b/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php
deleted file mode 100644
index 848c493b68..0000000000
--- a/app/Generator/Chart/Budget/GoogleBudgetChartGenerator.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\Budget;
-
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-
-/**
- * Class GoogleBudgetChartGenerator
- *
- * @package FireflyIII\Generator\Chart\Budget
- */
-class GoogleBudgetChartGenerator implements BudgetChartGenerator
-{
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function budget(Collection $entries)
- {
-
- $chart = new GChart;
- $chart->addColumn(trans('firefly.period'), 'date');
- $chart->addColumn(trans('firefly.spent'), 'number');
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRow($entry[0], $entry[1]);
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @codeCoverageIgnore
- *
- * @param Collection $entries
- *
- * @return array
- */
- public function budgetLimit(Collection $entries)
- {
- return $this->budget($entries);
- }
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function frontpage(Collection $entries)
- {
- $chart = new GChart;
- $chart->addColumn(trans('firefly.budget'), 'string');
- $chart->addColumn(trans('firefly.left'), 'number');
- $chart->addColumn(trans('firefly.spent'), 'number');
- $chart->addColumn(trans('firefly.overspent'), 'number');
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
- $chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
- }
- }
-
-
- $chart->generate();
-
- return $chart->getData();
-
- }
-
- /**
- * @param Collection $budgets
- * @param Collection $entries
- *
- * @return array
- */
- public function year(Collection $budgets, Collection $entries)
- {
- $chart = new GChart;
- // add columns:
- $chart->addColumn(trans('firefly.month'), 'date');
- foreach ($budgets as $budget) {
- $chart->addColumn($budget->name, 'number');
- }
-
- /** @var array $entry */
- foreach ($entries as $entry) {
-
- $chart->addRowArray($entry);
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-}
diff --git a/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php b/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php
deleted file mode 100644
index 5ce9fe35da..0000000000
--- a/app/Generator/Chart/Category/GoogleCategoryChartGenerator.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\Category;
-
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-
-/**
- * Class GoogleCategoryChartGenerator
- *
- * @package FireflyIII\Generator\Chart\Category
- */
-class GoogleCategoryChartGenerator implements CategoryChartGenerator
-{
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function all(Collection $entries)
- {
- $chart = new GChart;
- $chart->addColumn(trans('firefly.period'), 'date');
- $chart->addColumn(trans('firefly.spent'), 'number');
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRow($entry[0], $entry[1]);
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function frontpage(Collection $entries)
- {
- $chart = new GChart;
- $chart->addColumn(trans('firefly.category'), 'string');
- $chart->addColumn(trans('firefly.spent'), 'number');
-
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- $sum = $entry['sum'];
- if ($sum != 0) {
- $chart->addRow($entry['name'], $sum);
- }
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function month(Collection $entries)
- {
- $chart = new GChart;
-
- $chart->addColumn(trans('firefly.period'), 'date');
- $chart->addColumn(trans('firefly.spent'), 'number');
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRow($entry[0], $entry[1]);
- }
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param Collection $categories
- * @param Collection $entries
- *
- * @return array
- */
- public function spentInYear(Collection $categories, Collection $entries)
- {
- $chart = new GChart;
-
- $chart->addColumn(trans('firefly.month'), 'date');
- foreach ($categories as $category) {
- $chart->addColumn($category->name, 'number');
- }
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRowArray($entry);
- }
- $chart->generate();
-
- return $chart->getData();
-
- }
-
- /**
- * @param Collection $categories
- * @param Collection $entries
- *
- * @return array
- */
- public function earnedInYear(Collection $categories, Collection $entries)
- {
- $chart = new GChart;
-
- $chart->addColumn(trans('firefly.month'), 'date');
- foreach ($categories as $category) {
- $chart->addColumn($category->name, 'number');
- }
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRowArray($entry);
- }
- $chart->generate();
-
- return $chart->getData();
-
- }
-}
diff --git a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php
index 0bd146b737..8927d1bb91 100644
--- a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php
+++ b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php
@@ -9,7 +9,7 @@ use Preferences;
/**
- * Class GooglePiggyBankChartGenerator
+ * Class ChartJsPiggyBankChartGenerator
*
* @package FireflyIII\Generator\Chart\PiggyBank
*/
diff --git a/app/Generator/Chart/PiggyBank/GooglePiggyBankChartGenerator.php b/app/Generator/Chart/PiggyBank/GooglePiggyBankChartGenerator.php
deleted file mode 100644
index 15d6eb9931..0000000000
--- a/app/Generator/Chart/PiggyBank/GooglePiggyBankChartGenerator.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\PiggyBank;
-
-use Carbon\Carbon;
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-
-
-/**
- * Class GooglePiggyBankChartGenerator
- *
- * @package FireflyIII\Generator\Chart\PiggyBank
- */
-class GooglePiggyBankChartGenerator implements PiggyBankChartGenerator
-{
-
- /**
- * @param Collection $set
- *
- * @return array
- */
- public function history(Collection $set)
- {
- $chart = new GChart;
- $chart->addColumn(trans('firefly.date'), 'date');
- $chart->addColumn(trans('firefly.balance'), 'number');
-
- $sum = '0';
- bcscale(2);
-
- foreach ($set as $entry) {
- $sum = bcadd($sum, $entry->sum);
- $chart->addRow(new Carbon($entry->date), $sum);
- }
-
- $chart->generate();
-
- return $chart->getData();
- }
-}
diff --git a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
index ef9a921ef1..ef9611ff31 100644
--- a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
+++ b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php
@@ -7,7 +7,7 @@ use Illuminate\Support\Collection;
use Preferences;
/**
- * Class GoogleReportChartGenerator
+ * Class ChartJsReportChartGenerator
*
* @package FireflyIII\Generator\Chart\Report
*/
diff --git a/app/Generator/Chart/Report/GoogleReportChartGenerator.php b/app/Generator/Chart/Report/GoogleReportChartGenerator.php
deleted file mode 100644
index f995596687..0000000000
--- a/app/Generator/Chart/Report/GoogleReportChartGenerator.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-namespace FireflyIII\Generator\Chart\Report;
-
-use Grumpydictator\Gchart\GChart;
-use Illuminate\Support\Collection;
-
-/**
- * Class GoogleReportChartGenerator
- *
- * @package FireflyIII\Generator\Chart\Report
- */
-class GoogleReportChartGenerator implements ReportChartGenerator
-{
-
- /**
- * @param Collection $entries
- *
- * @return array
- */
- public function yearInOut(Collection $entries)
- {
- $chart = new GChart;
- $chart->addColumn(trans('firefly.month'), 'date');
- $chart->addColumn(trans('firefly.income'), 'number');
- $chart->addColumn(trans('firefly.expenses'), 'number');
-
- /** @var array $entry */
- foreach ($entries as $entry) {
- $chart->addRowArray($entry);
- }
- $chart->generate();
-
- return $chart->getData();
- }
-
- /**
- * @param string $income
- * @param string $expense
- * @param int $count
- *
- * @return array
- */
- public function yearInOutSummarized($income, $expense, $count)
- {
- $chart = new GChart;
-
- $chart->addColumn(trans('firefly.summary'), 'string');
- $chart->addColumn(trans('firefly.income'), 'number');
- $chart->addColumn(trans('firefly.expenses'), 'number');
- $chart->addRow(trans('firefly.sum'), $income, $expense);
- $chart->addRow(trans('firefly.average'), ($income / $count), ($expense / $count));
-
- $chart->generate();
-
- return $chart->getData();
- }
-}
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index 45e2d5bb62..6f5643752d 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -98,7 +98,6 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind('FireflyIII\Helpers\Attachments\AttachmentHelperInterface', 'FireflyIII\Helpers\Attachments\AttachmentHelper');
// make charts:
- // alternative is Google instead of ChartJs
$this->app->bind('FireflyIII\Generator\Chart\Account\AccountChartGenerator', 'FireflyIII\Generator\Chart\Account\ChartJsAccountChartGenerator');
$this->app->bind('FireflyIII\Generator\Chart\Bill\BillChartGenerator', 'FireflyIII\Generator\Chart\Bill\ChartJsBillChartGenerator');
$this->app->bind('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator', 'FireflyIII\Generator\Chart\Budget\ChartJsBudgetChartGenerator');
diff --git a/public/css/firefly.css b/public/css/firefly.css
index 147bcec4f0..f60f7b03c6 100644
--- a/public/css/firefly.css
+++ b/public/css/firefly.css
@@ -1,5 +1,5 @@
#daterange {cursor:pointer;}
-.google-chart-error {height:30px;background:url('/images/error.png') no-repeat center center;}
+.general-chart-error {height:30px;background:url('/images/error.png') no-repeat center center;}
.handle {cursor:move;}
.ui-sortable-placeholder {
diff --git a/public/js/charts.js b/public/js/charts.js
index 447186790b..b880cbc629 100644
--- a/public/js/charts.js
+++ b/public/js/charts.js
@@ -147,7 +147,7 @@ function lineChart(URL, container, options) {
new Chart(ctx).Line(newData, options);
}).fail(function () {
- $('#' + container).addClass('google-chart-error');
+ $('#' + container).addClass('general-chart-error');
});
console.log('URL for line chart : ' + URL);
}
@@ -182,7 +182,7 @@ function areaChart(URL, container, options) {
new Chart(ctx).Line(newData, options);
}).fail(function () {
- $('#' + container).addClass('google-chart-error');
+ $('#' + container).addClass('general-chart-error');
});
console.log('URL for area chart: ' + URL);
@@ -218,7 +218,7 @@ function columnChart(URL, container, options) {
new Chart(ctx).Bar(newData, options);
}).fail(function () {
- $('#' + container).addClass('google-chart-error');
+ $('#' + container).addClass('general-chart-error');
});
console.log('URL for column chart : ' + URL);
}
@@ -253,7 +253,7 @@ function stackedColumnChart(URL, container, options) {
new Chart(ctx).StackedBar(newData, options);
}).fail(function () {
- $('#' + container).addClass('google-chart-error');
+ $('#' + container).addClass('general-chart-error');
});
console.log('URL for stacked column chart : ' + URL);
}
@@ -286,7 +286,7 @@ function pieChart(URL, container, options) {
new Chart(ctx).Pie(data, options);
}).fail(function () {
- $('#' + container).addClass('google-chart-error');
+ $('#' + container).addClass('general-chart-error');
});
diff --git a/public/js/gcharts.js b/public/js/gcharts.js
deleted file mode 100644
index 64c1431dba..0000000000
--- a/public/js/gcharts.js
+++ /dev/null
@@ -1,319 +0,0 @@
-/* globals currencyCode, language */
-/* exported lineChart, googleColumnChart, stackedColumnChart, comboChart, pieChart, defaultLineChartOptions, defaultAreaChartOptions, defaultBarChartOptions, defaultComboChartOptions, defaultColumnChartOptions, defaultStackedColumnChartOptions, defaultPieChartOptions */
-var google = google || {};
-google.load('visualization', '1.1', {'packages': ['corechart', 'bar', 'line'], 'language': language});
-
-
-/* exported */
-
-var defaultLineChartOptions = {
- curveType: 'function',
- legend: {
- position: 'none'
- },
- interpolateNulls: true,
- lineWidth: 1,
- chartArea: {
- left: 50,
- top: 10,
- width: '95%',
- height: '90%'
- },
- height: 400,
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- hAxis: {
- textStyle: {
- color: '#838383',
- },
- baselineColor: '#aaaaaa',
- gridlines: {
- color: 'transparent'
- }
- },
- fontSize: 11,
- vAxis: {
- textStyle: {
- color: '#838383',
- },
- baselineColor: '#aaaaaa',
- format: '\u20AC #'
- }
-
-
-};
-
-var defaultAreaChartOptions = {
- curveType: 'function',
- legend: {
- position: 'none'
- },
- interpolateNulls: true,
- lineWidth: 1,
- chartArea: {
- left: 50,
- top: 10,
- width: '95%',
- height: '90%'
- },
- height: 400,
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- hAxis: {
- textStyle: {
- color: '#838383',
- },
- baselineColor: '#aaaaaa',
- gridlines: {
- color: 'transparent'
- }
- },
- fontSize: 11,
- vAxis: {
- textStyle: {
- color: '#838383',
- },
- baselineColor: '#aaaaaa',
- format: '\u20AC #'
- }
-
-
-};
-
-var defaultBarChartOptions = {
- height: 400,
- bars: 'horizontal',
- hAxis: {
- textStyle: {
- color: '#838383',
- },
- baselineColor: '#aaaaaa',
- format: '\u20AC #'
-
- },
- fontSize: 11,
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- vAxis: {
- textStyle: {
- color: '#838383'
- },
- textPosition: 'in',
- gridlines: {
-
- color: 'transparent'
- },
- baselineColor: '#aaaaaa'
- },
- chartArea: {
- left: 15,
- top: 10,
- width: '100%',
- height: '90%'
- },
-
- legend: {
- position: 'none'
- }
-};
-
-var defaultComboChartOptions = {
- height: 300,
- chartArea: {
- left: 75,
- top: 10,
- width: '100%',
- height: '90%'
- },
- vAxis: {
- minValue: 0,
- format: '\u20AC #'
- },
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- fontSize: 11,
- legend: {
- position: 'none'
- },
- series: {
- 0: {type: 'line'},
- 1: {type: 'line'},
- 2: {type: 'bars'}
- },
- bar: {groupWidth: 20}
-};
-
-var defaultColumnChartOptions = {
- height: 400,
- chartArea: {
- left: 50,
- top: 10,
- width: '85%',
- height: '80%'
- },
- fontSize: 11,
- hAxis: {
- textStyle: {
- color: '#838383'
- },
- gridlines: {
- color: 'transparent'
- },
- baselineColor: '#aaaaaa'
-
- },
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- vAxis: {
- textStyle: {
- color: '#838383'
- },
- baselineColor: '#aaaaaa',
- format: '\u20AC #'
- },
- legend: {
- position: 'none'
- }
-};
-
-var defaultStackedColumnChartOptions = {
- height: 400,
- chartArea: {
- left: 50,
- top: 10,
- width: '85%',
- height: '80%'
- },
- legend: {
- position: 'none'
- },
- fontSize: 11,
- isStacked: true,
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
- hAxis: {
- textStyle: {
- color: '#838383',
- },
- gridlines: {
- color: 'transparent'
- }
- },
- vAxis: {
- textStyle: {
- color: '#838383',
- },
- format: '\u20AC #'
- }
-};
-
-var defaultPieChartOptions = {
- chartArea: {
- left: 0,
- top: 0,
- width: '100%',
- height: '100%'
- },
- fontSize: 11,
- height: 200,
- legend: {
- position: 'none'
- },
- colors: ["#357ca5", "#008d4c", "#db8b0b", "#ca195a", "#555299", "#4285f4", "#db4437", "#f4b400", "#0f9d58", "#ab47bc", "#00acc1", "#ff7043", "#9e9d24", "#5c6bc0", "#f06292", "#00796b", "#c2185b"],
-};
-
-
-function googleChart(chartType, URL, container, options) {
- "use strict";
- if ($('#' + container).length === 1) {
- $.getJSON(URL).success(function (data) {
- /*
- Get the data from the JSON
- */
- var gdata = new google.visualization.DataTable(data);
-
- /*
- Format as money
- */
- var money = new google.visualization.NumberFormat({
- decimalSymbol: ',',
- groupingSymbol: '.',
- prefix: currencyCode + ' '
- });
- for (var i = 1; i < gdata.getNumberOfColumns(); i++) {
- money.format(gdata, i);
- }
-
- /*
- Create a new google charts object.
- */
- var chart = false;
- var options = false;
- if (chartType === 'line') {
- chart = new google.visualization.LineChart(document.getElementById(container));
- options = options || defaultLineChartOptions;
- }
- if (chartType === 'area') {
- chart = new google.visualization.AreaChart(document.getElementById(container));
- options = options || defaultAreaChartOptions;
- }
-
- if (chartType === 'column') {
- chart = new google.visualization.ColumnChart(document.getElementById(container));
- options = options || defaultColumnChartOptions;
- }
- if (chartType === 'pie') {
- chart = new google.visualization.PieChart(document.getElementById(container));
- options = options || defaultPieChartOptions;
- }
- if (chartType === 'bar') {
- chart = new google.visualization.BarChart(document.getElementById(container));
- options = options || defaultBarChartOptions;
- }
- if (chartType === 'stackedColumn') {
- chart = new google.visualization.ColumnChart(document.getElementById(container));
- options = options || defaultStackedColumnChartOptions;
- }
- if (chartType === 'combo') {
- chart = new google.visualization.ComboChart(document.getElementById(container));
- options = options || defaultComboChartOptions;
- }
-
- if (chart === false) {
- alert('Cannot draw chart of type "' + chartType + '".');
- } else {
- chart.draw(gdata, options);
- }
-
- }).fail(function () {
- $('#' + container).addClass('google-chart-error');
- });
- } else {
- console.log('No container found called "' + container + '"');
- }
-}
-
-
-function lineChart(URL, container, options) {
- "use strict";
- return googleChart('line', URL, container, options);
-}
-
-function areaChart(URL, container, options) {
- "use strict";
- return googleChart('area', URL, container, options);
-}
-
-function columnChart(URL, container, options) {
- "use strict";
- return googleChart('column', URL, container, options);
-}
-
-function stackedColumnChart(URL, container, options) {
- "use strict";
- return googleChart('stackedColumn', URL, container, options);
-}
-
-function comboChart(URL, container, options) {
- "use strict";
- return googleChart('combo', URL, container, options);
-}
-
-function pieChart(URL, container, options) {
- "use strict";
- return googleChart('pie', URL, container, options);
-}
diff --git a/public/js/index.js b/public/js/index.js
index fa3962a85f..597233fb72 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2,13 +2,8 @@
$(function () {
"use strict";
- if (typeof google !== 'undefined') {
- // do google charts:
- google.setOnLoadCallback(drawChart);
- } else {
- // do chart JS stuff.
- drawChart();
- }
+ // do chart JS stuff.
+ drawChart();
if (showTour) {
$.getJSON('json/tour').success(function (data) {
var tour = new Tour(
diff --git a/public/js/reports.js b/public/js/reports.js
index 7652eaf40a..b123497481 100644
--- a/public/js/reports.js
+++ b/public/js/reports.js
@@ -2,11 +2,7 @@
$(function () {
"use strict";
- if (typeof(google) !== 'undefined') {
- google.setOnLoadCallback(drawChart);
- } else {
- drawChart();
- }
+ drawChart();
});