fix: Correct decimal places, rather than rounding to the nearest 0.01

This commit is contained in:
NunoSempere 2021-11-08 21:09:06 +00:00
parent 9eeb35f998
commit f0525245de

View File

@ -10,7 +10,7 @@ let formatLargeOrSmall = num => {
}else if(num != 0){ }else if(num != 0){
return num.toFixed(-Math.floor(Math.log(num)/Math.log(10))); return num.toFixed(-Math.floor(Math.log(num)/Math.log(10)));
}else{ }else{
return "~0" return num//return "~0"
} }
} }
@ -75,7 +75,8 @@ function findDistance({sourceElementId, targetElementId, nodes, links}){
} }
//let sum = JSON.stringify(weights)//weights.length > 0 ? weights.reduce((a,b) => (a+b)) / weights.length : "Not found" //let sum = JSON.stringify(weights)//weights.length > 0 ? weights.reduce((a,b) => (a+b)) / weights.length : "Not found"
//return sum //return sum
return weights.map(weight => Math.round(weight*100)/100) return weights
//return weights.map(weight => Math.round(weight*100)/100)
} }
function findDistancesForAllElements({nodes, links}){ function findDistancesForAllElements({nodes, links}){