Project

General

Profile

Bug #14933 ยป traffic-graphs.js.patch

fix for issue - Patrik Stahlman, 10/28/2023 09:42 PM

View differences:

/usr/local/www/js/traffic-graphs.js 2023-10-28 21:59:19.647378000 +0200
for(var i = 0; i < interfaceSize; i ++){
priorIn[i] = new Array();
priorOut[i] = new Array();
if( smoothing > 0 ){
if(smoothing > 0) {
priorIn[i][0] = 0;
priorOut[i][0] = 0;
}
......
var trafficIn = ( priorIn[interfaceCount].reduce(function(a, b){ return a + b; },0) + currentIn)/(1 + priorIn[interfaceCount].length);
var trafficOut = ( priorOut[interfaceCount].reduce(function(a, b){ return a + b; },0) + currentOut) /(1 + priorOut[interfaceCount].length);
// circular array to keep track of 'x' amount of data points
priorIn[interfaceCount][smoothCount] = currentIn;
priorOut[interfaceCount][smoothCount] = currentOut;
if(smoothing > 0) {
priorIn[interfaceCount][smoothCount] = currentIn;
priorOut[interfaceCount][smoothCount] = currentOut;
}
if(window.invert) {
trafficOut = 0 - trafficOut;
}
......
interfaceCount = interfaceCount % interfaceSize;
});
// increment the circular array
smoothCount ++;
smoothCount = smoothCount % smoothing;
if(smoothing > 0) {
smoothCount ++;
smoothCount = smoothCount % smoothing;
}
refreshGraphFunction_running = false;
});
    (1-1/1)