Do not attempt to render budget graph when no data available

This commit is contained in:
Yingtong Li 2023-05-01 18:28:42 +10:00
parent 5994cd38b6
commit 7f6bf1b07f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -156,6 +156,7 @@ function makeGrid() {
function makeCharts() { function makeCharts() {
// Display expense, revenue charts on budget view page // Display expense, revenue charts on budget view page
if (document.getElementById('chartExpenses')) {
new Chart(document.getElementById('chartExpenses'), { new Chart(document.getElementById('chartExpenses'), {
type: 'pie', type: 'pie',
data: { data: {
@ -175,7 +176,9 @@ function makeCharts() {
} }
}, },
}); });
}
if (document.getElementById('chartRevExp')) {
new Chart(document.getElementById('chartRevExp'), { new Chart(document.getElementById('chartRevExp'), {
type: 'bar', type: 'bar',
data: { data: {
@ -205,3 +208,4 @@ function makeCharts() {
}, },
}); });
} }
}