Finally fixed bit vs bytes in graphs

Fixed wrong JS function to convert bits in Mbits
This commit is contained in:
Luca Deri 2015-09-29 00:35:39 +02:00
parent 9efc511950
commit e11d9c94bd
2 changed files with 7 additions and 7 deletions

View file

@ -548,8 +548,8 @@ function fdate(when) {
function fbits(bits) {
var sizes = ['bps', 'Kbit/s', 'Mbit/s', 'Gbit/s', 'Tbit/s'];
if(bits == 0) return 'n/a';
var i = parseInt(Math.floor(Math.log(bits) / Math.log(1024)));
return Math.round(bits / Math.pow(1024, i), 2) + ' ' + sizes[i];
var i = parseInt(Math.floor(Math.log(bits) / Math.log(1000)));
return Math.round(bits / Math.pow(1000, i), 2) + ' ' + sizes[i];
}
function capitaliseFirstLetter(string)
@ -1297,7 +1297,7 @@ function singlerrd2json(ifid, host, rrdFile, start_time, end_time, rickshaw_json
end
if (s[elemId] == nil) then s[elemId] = 0 end
s[elemId] = s[elemId] + w -- bps
s[elemId] = s[elemId] + w*8 -- bps
--if(s[elemId] > 0) then io.write("[".. elemId .. "]=" .. s[elemId] .."\n") end
elemId = elemId + 1
end