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
1 changed files with 46 additions and 42 deletions

View File

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