Remove chart when nothing to show.

This commit is contained in:
Sander Dorigo 2014-10-14 07:27:06 +02:00
parent b7517b49ed
commit aceb683d07

View File

@ -212,41 +212,45 @@ $(function () {
}); });
$.getJSON('chart/home/recurring').success(function (data) { $.getJSON('chart/home/recurring').success(function (data) {
$('#recurring').highcharts({ if (data[0].data.length == 0) {
title: { $('#recurring').parent().parent().remove();
text: null } else {
}, $('#recurring').highcharts({
credits: { title: {
enabled: false text: null
}, },
tooltip: { credits: {
formatter: function () { enabled: false
if (this.point.objType == 'paid') { },
return this.key + ': \u20AC ' + Highcharts.numberFormat(this.y, 2); tooltip: {
} else { formatter: function () {
return this.key + ': ~\u20AC ' + Highcharts.numberFormat(this.y, 2); 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;
}
} }
},
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
} }
} },
}, plotOptions: {
series: data pie: {
}); events: {
click: function (e) {
if (e.point.url != null) {
window.location = e.point.url;
}
}
},
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
}
}
},
series: data
});
}
}); });
}); });