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
129 129
	for(var i = 0; i < interfaceSize; i ++){
130 130
		priorIn[i] = new Array();
131 131
		priorOut[i] = new Array();
132
		if( smoothing > 0 ){
132
		if(smoothing > 0) {
133 133
			priorIn[i][0] = 0;
134 134
			priorOut[i][0] = 0;
135 135
		}
......
286 286
					var trafficIn = ( priorIn[interfaceCount].reduce(function(a, b){ return a + b; },0) + currentIn)/(1 + priorIn[interfaceCount].length);
287 287
					var trafficOut = ( priorOut[interfaceCount].reduce(function(a, b){ return a + b; },0) + currentOut) /(1 + priorOut[interfaceCount].length);
288 288
					// circular array to keep track of 'x' amount of data points
289
					priorIn[interfaceCount][smoothCount] = currentIn;
290
					priorOut[interfaceCount][smoothCount] = currentOut;
289
					if(smoothing > 0) {
290
						priorIn[interfaceCount][smoothCount] = currentIn;
291
						priorOut[interfaceCount][smoothCount] = currentOut;
292
					}
291 293
					if(window.invert) {
292 294
						trafficOut = 0 - trafficOut;
293 295
					}
......
338 340
				interfaceCount = interfaceCount % interfaceSize;
339 341
			});
340 342
			// increment the circular array
341
			smoothCount ++;
342
			smoothCount = smoothCount % smoothing;
343
			if(smoothing > 0) {
344
				smoothCount ++;
345
				smoothCount = smoothCount % smoothing;
346
			}
343 347
			refreshGraphFunction_running = false;
344 348
		});
    (1-1/1)