Improves y-axis labels in community historical graphs

fixes #682
This commit is contained in:
Simone Mainardi 2016-08-11 11:42:22 +02:00
parent f1c25e7d77
commit 781b3d4988

View file

@ -650,7 +650,7 @@ function fdate(when) {
function fbits(bits) {
var sizes = ['bps', 'Kbit/s', 'Mbit/s', 'Gbit/s', 'Tbit/s'];
if(bits == 0) return 'n/a';
if(bits == 0) return '';
var i = parseInt(Math.floor(Math.log(bits) / Math.log(1000)));
return Math.round(bits / Math.pow(1000, i), 2) + ' ' + sizes[i];
}