maybe this is the right way

This commit is contained in:
Expand-sys 2021-06-06 13:04:45 +10:00
parent 5c6844e923
commit 107f97eb67
2 changed files with 4 additions and 4 deletions

View file

@ -214,12 +214,12 @@ app.get("/BankF", ensureAuthenticated, async function (req, res) {
console.log(graphlog);
let graphdata = '["transaction", "balance"]';
let currentbal = balance.value;
for (i in graphlog) {
for (i = graphlog.length - 1; i > -1; i--) {
if (graphlog[i].from == req.session.user) {
currentbal = parseInt(currentbal) - parseInt(graphlog[i].amount);
currentbal = parseInt(currentbal) + parseInt(graphlog[i].amount);
graphdata = graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
} else {
currentbal = parseInt(currentbal) + parseInt(graphlog[i].amount);
currentbal = parseInt(currentbal) - parseInt(graphlog[i].amount);
graphdata = graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
}
}

View file

@ -71,7 +71,7 @@ block content
var options = {
title: 'Balance',
hAxis: {title: 'Transaction', minValue: 0, maxValue: 15, direction: -1, textPosition: 'none'},
hAxis: {title: 'Transaction', minValue: 0, maxValue: 15, direction: 1, textPosition: 'none'},
vAxis: {title: 'Balance', minValue: 0, maxValue: 500},
legend: 'none'
};