Skip to content

Firefly III: a personal finances manager

Remove chart when nothing to show.

Sander Dorigoaceb683d0731
diff --git a/public/assets/javascript/firefly/index.js b/public/assets/javascript/firefly/index.js
index 0b8d96318a..b8d5efda98 100644
--- a/public/assets/javascript/firefly/index.js
+++ b/public/assets/javascript/firefly/index.js
@@ -212,41 +212,45 @@ $(function () {
});
$.getJSON('chart/home/recurring').success(function (data) {
- $('#recurring').highcharts({
- title: {
- text: null
- },
- credits: {
- enabled: false
- },
- tooltip: {
- formatter: function () {
- if (this.point.objType == 'paid') {
- return this.key + ': \u20AC ' + Highcharts.numberFormat(this.y, 2);
- } else {
- return this.key + ': ~\u20AC ' + Highcharts.numberFormat(this.y, 2);
- }
+ if (data[0].data.length == 0) {
+ $('#recurring').parent().parent().remove();
+ } else {
+ $('#recurring').highcharts({
+ title: {
+ text: null
+ },
+ credits: {
+ enabled: false
+ },
+ tooltip: {
+ formatter: function () {
+ if (this.point.objType == 'paid') {
+ return this.key + ': \u20AC ' + Highcharts.numberFormat(this.y, 2);
+ } else {
+ return this.key + ': ~\u20AC ' + Highcharts.numberFormat(this.y, 2);
+ }
- }
- },
- plotOptions: {
- pie: {
- events: {
- click: function (e) {
- if (e.point.url != null) {
- window.location = e.point.url;
+ }
+ },
+ plotOptions: {
+ pie: {
+ events: {
+ click: function (e) {
+ if (e.point.url != null) {
+ window.location = e.point.url;
+ }
}
+ },
+ allowPointSelect: true,
+ cursor: 'pointer',
+ dataLabels: {
+ enabled: false
}
- },
- allowPointSelect: true,
- cursor: 'pointer',
- dataLabels: {
- enabled: false
}
- }
- },
- series: data
- });
+ },
+ series: data
+ });
+ }
});
});
\ No newline at end of file