--- /usr/local/www/js/traffic-graphs.js.orig 2023-10-28 18:57:00.075073000 +0200 +++ /usr/local/www/js/traffic-graphs.js 2023-10-28 21:59:19.647378000 +0200 @@ -129,7 +129,7 @@ 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; } @@ -286,8 +286,10 @@ 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; } @@ -338,8 +340,10 @@ interfaceCount = interfaceCount % interfaceSize; }); // increment the circular array - smoothCount ++; - smoothCount = smoothCount % smoothing; + if(smoothing > 0) { + smoothCount ++; + smoothCount = smoothCount % smoothing; + } refreshGraphFunction_running = false; });