1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

modified the mptcp graph into no downline of download graph and upload graph.

This commit is contained in:
李斌 2018-05-16 21:29:25 +08:00
parent 602aa8a127
commit 927bb0df77

View file

@ -367,19 +367,15 @@
var el = Gdn.getElementById('rx').parentNode;
// intialize upline and downline datas for download and upload
// intialize upline datas for download and upload,the downline should be zero.
var uplineDnl = { };
var downlineDnl = { };
var uplineUpl = { };
var downlineUpl = { };
// fetch upline and downline datas
var toadditf = [ ];
for (var itf in data)
{
uplineDnl[itf] = [ ];
downlineDnl[itf]= [ ];
uplineUpl[itf] = [ ];
downlineUpl[itf]= [ ];
// build point sets
var data_tx_avg;
var data_rx_avg;
@ -395,10 +391,10 @@
tx_bot += updata[toadditf[j]][i];
}
// set upline of the interface
uplineDnl[itf][i] = dndata[itf][i] + rx_bot;
uplineDnl[itf][i] = dndata[itf][i];
data_rx_peak = Math.max(data_rx_peak, dndata[itf][i]);
data_max_dnl = Math.max(data_max_dnl, uplineDnl[itf][i]);
uplineUpl[itf][i] = updata[itf][i] + tx_bot;
uplineUpl[itf][i] = updata[itf][i];
data_tx_peak = Math.max(data_tx_peak, updata[itf][i]);
data_max_upl = Math.max(data_max_upl, uplineUpl[itf][i]);
@ -412,12 +408,6 @@
data_rx_avg = dndata[itf][i];
data_tx_avg = updata[itf][i];
}
if(toadditf.length)
{
downlineDnl[itf][i] = uplineDnl[toadditf[toadditf.length-1]][i];
downlineUpl[itf][i] = uplineUpl[toadditf[toadditf.length-1]][i];
}
}
toadditf.push(itf);
// Update stats labels
@ -480,31 +470,6 @@
pt_tx += ' ' + width + ',' + y_tx;
pt_tx += ' ' + width + ',' + height;
for (var i = downlineDnl[itf].length - 1; i >= 0; i--)
{
var x = i * step;
y_rx = height - Math.floor((downlineDnl[itf][i] - 10) * data_scale_dnl);
y_tx = height - Math.floor((downlineUpl[itf][i] - 10) * data_scale_upl);
// recreate tangant point in bottom line graph
if(i == downlineDnl[itf].length - 1)
{
pt_rx += ' ' + width + ',' + height;
pt_rx += ' ' + width + ',' + y_rx;
pt_tx += ' ' + width + ',' + height;
pt_tx += ' ' + width + ',' + y_tx;
}
pt_rx += ' ' + x + ',' + y_rx;
pt_tx += ' ' + x + ',' + y_tx;
}
// go back to right bottom corner to correctly fill polyline
pt_tx += ' ' + 0 + ',' + height;
pt_tx += ' ' + width + ',' + height;
pt_rx += ' ' + 0 + ',' + height;
pt_rx += ' ' + width + ',' + height;
// Draw polygon
dnPolygons[itf].setAttribute('points', pt_rx);
upPolygons[itf].setAttribute('points', pt_tx);