Skip to content

Commit c488cb2

Browse files
committed
visualization for speed
1 parent 3d40511 commit c488cb2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/DemoTestVisualization.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,21 @@ var DemoTestVisualization = (function () {
212212
$("#infoping span").text(showping);
213213
}
214214

215-
if (down > 0) {
215+
if (down >= 0) {
216+
$("#testspeedprogress").show();
216217
showdown = (down / 1000000);
217218
showdown = showdown.toPrecision(3) + " Mbps";
218219
$("#infodown span").text(showdown);
220+
$("#testspeed").css("width", (result.downBitPerSecLog / 4 * 100) + "%");
221+
$("#testspeed").text(showdown);
219222
}
220223

221-
if (up > 0) {
224+
if (up >= 0) {
222225
showup = (up / 1000000);
223226
showup = showup.toPrecision(3) + " Mbps";
224227
$("#infoup span").text(showup);
228+
$("#testspeed").css("width", (result.upBitPerSecLog / 4 * 100) + "%");
229+
$("#testspeed").text(showup);
225230
}
226231

227232
function drawLoop() {
@@ -238,12 +243,14 @@ var DemoTestVisualization = (function () {
238243
_redraw_loop = setTimeout(draw, 250);
239244
//Draw a new chart
240245
} else if (status === "ERROR" || status === "ABORTED") {
246+
$("#testspeedprogress").hide();
241247
if (_successCallback !== null) {
242248
var t = _errorCallback;
243249
_errorCallback = null;
244250
t(result);
245251
}
246252
} else if (status === "END") {
253+
$("#testspeedprogress").hide();
247254
// call callback that the test is finished
248255
if (_successCallback !== null) {
249256
var t = _successCallback;

test/Websockettest.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ <h3>Measurement</h3>
7171
<div class="progress">
7272
<div id="testprogress" class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="min-width: 3em; width: 0%;">0 %</div>
7373
</div>
74+
<div class="progress" id="testspeedprogress" style="display: none;">
75+
<div id="testspeed" class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="min-width: 3em; width: 0%;">0 Mbps</div>
76+
</div>
7477
<div id="infocurrent">
7578
<p>
7679
</p><div class="row">

0 commit comments

Comments
 (0)