-
Notifications
You must be signed in to change notification settings - Fork 1
/
iperf3-chart.html
462 lines (432 loc) · 20.1 KB
/
iperf3-chart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<html>
<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<!-- <script src="https://code.highcharts.com/modules/exporting.js"></script> -->
<style>
body {
background-color: #999;
}
.highcharts-figure {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
#container1,
#container2 {
background-image: url(https://www.highcharts.com/samples/graphics/sand.png);
/* background-image: linear-gradient(#fff8, #fffa), url(https://w.wallhaven.cc/full/2k/wallhaven-2kve86.png); */
/* background-size: cover; */
width: 650px;
height: 400px;
margin-left: 5px;
}
.highcharts-figure,
.highcharts-data-table table {
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
.input {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: start;
}
.input .json,
.input .iperf {
display: flex;
flex-direction: column;
align-items: center;
}
#json,
#iperf {
width: 320px;
height: 200px;
}
</style>
</head>
<body>
<figure class="highcharts-figure">
<div id="container1"></div>
<div id="container2"></div>
</figure>
<div class="input">
<select id="theme">
<option value="sand">白沙</option>
<option value="night">暮色</option>
</select>
<div class="json">
<textarea id="iperf">
iPhone SE2
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.251, port 54905
[ 5] local 192.168.1.91 port 5201 connected to 192.168.1.251 port 54906
[ ID] Interval Transfer Bitrate
[ 5] 0.00-0.10 sec 2.11 MBytes 177 Mbits/sec
[ 5] 0.10-0.20 sec 4.85 MBytes 404 Mbits/sec
[ 5] 0.20-0.30 sec 6.42 MBytes 543 Mbits/sec
[ 5] 0.30-0.40 sec 7.14 MBytes 598 Mbits/sec
[ 5] 0.40-0.50 sec 7.47 MBytes 626 Mbits/sec
[ 5] 0.50-0.60 sec 6.93 MBytes 581 Mbits/sec
[ 5] 0.60-0.70 sec 7.49 MBytes 628 Mbits/sec
[ 5] 0.70-0.80 sec 6.87 MBytes 577 Mbits/sec
[ 5] 0.80-0.90 sec 7.15 MBytes 600 Mbits/sec
[ 5] 0.90-1.00 sec 7.38 MBytes 618 Mbits/sec
[ 5] 1.00-1.10 sec 7.03 MBytes 589 Mbits/sec
[ 5] 1.10-1.20 sec 7.29 MBytes 613 Mbits/sec
[ 5] 1.20-1.30 sec 6.83 MBytes 573 Mbits/sec
[ 5] 1.30-1.40 sec 7.38 MBytes 619 Mbits/sec
[ 5] 1.40-1.50 sec 7.39 MBytes 619 Mbits/sec
[ 5] 1.50-1.60 sec 6.87 MBytes 578 Mbits/sec
[ 5] 1.60-1.70 sec 7.28 MBytes 602 Mbits/sec
[ 5] 1.70-1.80 sec 7.45 MBytes 633 Mbits/sec
[ 5] 1.80-1.90 sec 7.97 MBytes 669 Mbits/sec
[ 5] 1.90-2.00 sec 7.28 MBytes 610 Mbits/sec
[ 5] 2.00-2.10 sec 7.60 MBytes 638 Mbits/sec
[ 5] 2.10-2.20 sec 7.50 MBytes 616 Mbits/sec
[ 5] 2.20-2.30 sec 7.03 MBytes 601 Mbits/sec
[ 5] 2.30-2.40 sec 7.06 MBytes 592 Mbits/sec
[ 5] 2.40-2.50 sec 7.15 MBytes 599 Mbits/sec
[ 5] 2.50-2.60 sec 7.21 MBytes 605 Mbits/sec
[ 5] 2.60-2.70 sec 7.48 MBytes 627 Mbits/sec
[ 5] 2.70-2.80 sec 7.24 MBytes 606 Mbits/sec
[ 5] 2.80-2.90 sec 7.00 MBytes 587 Mbits/sec
[ 5] 2.90-3.00 sec 7.43 MBytes 624 Mbits/sec
[ 5] 3.00-3.10 sec 7.05 MBytes 584 Mbits/sec
[ 5] 3.10-3.20 sec 6.78 MBytes 576 Mbits/sec
[ 5] 3.20-3.30 sec 7.19 MBytes 604 Mbits/sec
[ 5] 3.30-3.40 sec 7.02 MBytes 589 Mbits/sec
[ 5] 3.40-3.50 sec 6.80 MBytes 570 Mbits/sec
[ 5] 3.50-3.60 sec 6.66 MBytes 558 Mbits/sec
[ 5] 3.60-3.70 sec 7.25 MBytes 609 Mbits/sec
[ 5] 3.70-3.80 sec 6.40 MBytes 531 Mbits/sec
[ 5] 3.80-3.90 sec 7.37 MBytes 625 Mbits/sec
[ 5] 3.90-4.00 sec 7.19 MBytes 604 Mbits/sec
[ 5] 4.00-4.10 sec 7.72 MBytes 636 Mbits/sec
[ 5] 4.10-4.20 sec 7.12 MBytes 608 Mbits/sec
[ 5] 4.20-4.30 sec 7.85 MBytes 659 Mbits/sec
[ 5] 4.30-4.40 sec 7.96 MBytes 657 Mbits/sec
[ 5] 4.40-4.50 sec 7.74 MBytes 659 Mbits/sec
[ 5] 4.50-4.60 sec 8.00 MBytes 672 Mbits/sec
[ 5] 4.60-4.70 sec 7.59 MBytes 636 Mbits/sec
[ 5] 4.70-4.80 sec 7.64 MBytes 641 Mbits/sec
[ 5] 4.80-4.90 sec 7.35 MBytes 617 Mbits/sec
[ 5] 4.90-5.00 sec 7.51 MBytes 631 Mbits/sec
[ 5] 5.00-5.10 sec 7.19 MBytes 603 Mbits/sec
[ 5] 5.10-5.20 sec 8.26 MBytes 681 Mbits/sec
[ 5] 5.20-5.30 sec 7.33 MBytes 626 Mbits/sec
[ 5] 5.30-5.40 sec 7.90 MBytes 663 Mbits/sec
[ 5] 5.40-5.50 sec 8.07 MBytes 676 Mbits/sec
[ 5] 5.50-5.60 sec 7.55 MBytes 628 Mbits/sec
[ 5] 5.60-5.70 sec 7.99 MBytes 674 Mbits/sec
[ 5] 5.70-5.80 sec 8.02 MBytes 668 Mbits/sec
[ 5] 5.80-5.90 sec 7.47 MBytes 615 Mbits/sec
[ 5] 5.90-6.00 sec 7.60 MBytes 650 Mbits/sec
[ 5] 6.00-6.10 sec 7.24 MBytes 614 Mbits/sec
[ 5] 6.10-6.20 sec 7.32 MBytes 613 Mbits/sec
[ 5] 6.20-6.30 sec 7.67 MBytes 644 Mbits/sec
[ 5] 6.30-6.40 sec 6.15 MBytes 502 Mbits/sec
[ 5] 6.40-6.50 sec 7.63 MBytes 659 Mbits/sec
[ 5] 6.50-6.60 sec 6.67 MBytes 559 Mbits/sec
[ 5] 6.60-6.70 sec 5.97 MBytes 498 Mbits/sec
[ 5] 6.70-6.80 sec 6.88 MBytes 575 Mbits/sec
[ 5] 6.80-6.90 sec 6.64 MBytes 561 Mbits/sec
[ 5] 6.90-7.00 sec 8.16 MBytes 667 Mbits/sec
[ 5] 7.00-7.10 sec 7.92 MBytes 683 Mbits/sec
[ 5] 7.10-7.20 sec 7.43 MBytes 618 Mbits/sec
[ 5] 7.20-7.30 sec 7.94 MBytes 672 Mbits/sec
[ 5] 7.30-7.40 sec 7.89 MBytes 661 Mbits/sec
[ 5] 7.40-7.50 sec 8.13 MBytes 682 Mbits/sec
[ 5] 7.50-7.60 sec 7.92 MBytes 665 Mbits/sec
[ 5] 7.60-7.70 sec 7.77 MBytes 651 Mbits/sec
[ 5] 7.70-7.80 sec 8.10 MBytes 680 Mbits/sec
[ 5] 7.80-7.90 sec 7.56 MBytes 633 Mbits/sec
[ 5] 7.90-8.00 sec 7.55 MBytes 625 Mbits/sec
[ 5] 8.00-8.10 sec 7.33 MBytes 624 Mbits/sec
[ 5] 8.10-8.20 sec 6.54 MBytes 548 Mbits/sec
[ 5] 8.20-8.30 sec 7.21 MBytes 586 Mbits/sec
[ 5] 8.30-8.40 sec 6.70 MBytes 579 Mbits/sec
[ 5] 8.40-8.50 sec 7.48 MBytes 629 Mbits/sec
[ 5] 8.50-8.60 sec 6.63 MBytes 556 Mbits/sec
[ 5] 8.60-8.70 sec 7.51 MBytes 630 Mbits/sec
[ 5] 8.70-8.80 sec 7.49 MBytes 608 Mbits/sec
[ 5] 8.80-8.90 sec 6.79 MBytes 587 Mbits/sec
[ 5] 8.90-9.00 sec 7.18 MBytes 602 Mbits/sec
[ 5] 9.00-9.10 sec 7.72 MBytes 651 Mbits/sec
[ 5] 9.10-9.20 sec 7.67 MBytes 643 Mbits/sec
[ 5] 9.20-9.30 sec 7.73 MBytes 649 Mbits/sec
[ 5] 9.30-9.40 sec 6.78 MBytes 563 Mbits/sec
[ 5] 9.40-9.50 sec 7.42 MBytes 628 Mbits/sec
[ 5] 9.50-9.60 sec 7.42 MBytes 623 Mbits/sec
[ 5] 9.60-9.70 sec 7.53 MBytes 630 Mbits/sec
[ 5] 9.70-9.80 sec 7.17 MBytes 603 Mbits/sec
[ 5] 9.80-9.90 sec 5.97 MBytes 501 Mbits/sec
[ 5] 9.90-10.00 sec 6.56 MBytes 551 Mbits/sec
[ 5] 10.00-10.02 sec 1.07 MBytes 381 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.02 sec 725 MBytes 607 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.251, port 54909
[ 5] local 192.168.1.91 port 5201 connected to 192.168.1.251 port 54910
[ ID] Interval Transfer Bitrate
[ 5] 0.00-0.10 sec 3.62 MBytes 304 Mbits/sec
[ 5] 0.10-0.20 sec 9.38 MBytes 785 Mbits/sec
[ 5] 0.20-0.30 sec 6.25 MBytes 525 Mbits/sec
[ 5] 0.30-0.40 sec 5.88 MBytes 490 Mbits/sec
[ 5] 0.40-0.50 sec 6.00 MBytes 499 Mbits/sec
[ 5] 0.50-0.60 sec 6.25 MBytes 528 Mbits/sec
[ 5] 0.60-0.70 sec 6.25 MBytes 529 Mbits/sec
[ 5] 0.70-0.80 sec 6.25 MBytes 517 Mbits/sec
[ 5] 0.80-0.90 sec 4.75 MBytes 402 Mbits/sec
[ 5] 0.90-1.01 sec 7.38 MBytes 570 Mbits/sec
[ 5] 1.01-1.11 sec 8.25 MBytes 704 Mbits/sec
[ 5] 1.11-1.20 sec 7.62 MBytes 691 Mbits/sec
[ 5] 1.20-1.30 sec 8.12 MBytes 680 Mbits/sec
[ 5] 1.30-1.40 sec 7.88 MBytes 660 Mbits/sec
[ 5] 1.40-1.50 sec 8.38 MBytes 697 Mbits/sec
[ 5] 1.50-1.60 sec 8.12 MBytes 682 Mbits/sec
[ 5] 1.60-1.71 sec 10.0 MBytes 775 Mbits/sec
[ 5] 1.71-1.81 sec 8.75 MBytes 751 Mbits/sec
[ 5] 1.81-1.90 sec 8.25 MBytes 709 Mbits/sec
[ 5] 1.90-2.00 sec 9.12 MBytes 802 Mbits/sec
[ 5] 2.00-2.11 sec 9.50 MBytes 719 Mbits/sec
[ 5] 2.11-2.20 sec 8.38 MBytes 782 Mbits/sec
[ 5] 2.20-2.30 sec 7.88 MBytes 656 Mbits/sec
[ 5] 2.30-2.41 sec 10.5 MBytes 798 Mbits/sec
[ 5] 2.41-2.51 sec 8.38 MBytes 735 Mbits/sec
[ 5] 2.51-2.61 sec 7.38 MBytes 626 Mbits/sec
[ 5] 2.61-2.70 sec 7.88 MBytes 692 Mbits/sec
[ 5] 2.70-2.80 sec 9.12 MBytes 778 Mbits/sec
[ 5] 2.80-2.91 sec 9.50 MBytes 748 Mbits/sec
[ 5] 2.91-3.00 sec 7.38 MBytes 638 Mbits/sec
[ 5] 3.00-3.10 sec 9.38 MBytes 783 Mbits/sec
[ 5] 3.10-3.20 sec 7.62 MBytes 660 Mbits/sec
[ 5] 3.20-3.31 sec 9.50 MBytes 758 Mbits/sec
[ 5] 3.31-3.40 sec 8.88 MBytes 780 Mbits/sec
[ 5] 3.40-3.51 sec 9.25 MBytes 723 Mbits/sec
[ 5] 3.51-3.60 sec 7.88 MBytes 690 Mbits/sec
[ 5] 3.60-3.70 sec 7.75 MBytes 654 Mbits/sec
[ 5] 3.70-3.81 sec 10.1 MBytes 774 Mbits/sec
[ 5] 3.81-3.91 sec 7.88 MBytes 716 Mbits/sec
[ 5] 3.91-4.01 sec 6.88 MBytes 573 Mbits/sec
[ 5] 4.01-4.10 sec 8.62 MBytes 754 Mbits/sec
[ 5] 4.10-4.21 sec 9.50 MBytes 758 Mbits/sec
[ 5] 4.21-4.30 sec 8.12 MBytes 722 Mbits/sec
[ 5] 4.30-4.41 sec 7.25 MBytes 591 Mbits/sec
[ 5] 4.41-4.50 sec 9.25 MBytes 816 Mbits/sec
[ 5] 4.50-4.60 sec 9.12 MBytes 761 Mbits/sec
[ 5] 4.60-4.71 sec 9.12 MBytes 717 Mbits/sec
[ 5] 4.71-4.80 sec 9.00 MBytes 791 Mbits/sec
[ 5] 4.80-4.91 sec 9.38 MBytes 767 Mbits/sec
[ 5] 4.91-5.01 sec 8.62 MBytes 720 Mbits/sec
[ 5] 5.01-5.11 sec 8.25 MBytes 691 Mbits/sec
[ 5] 5.11-5.20 sec 10.1 MBytes 882 Mbits/sec
[ 5] 5.20-5.31 sec 9.12 MBytes 739 Mbits/sec
[ 5] 5.31-5.40 sec 8.38 MBytes 739 Mbits/sec
[ 5] 5.40-5.51 sec 9.00 MBytes 721 Mbits/sec
[ 5] 5.51-5.60 sec 6.00 MBytes 531 Mbits/sec
[ 5] 5.60-5.71 sec 9.25 MBytes 732 Mbits/sec
[ 5] 5.71-5.81 sec 9.00 MBytes 735 Mbits/sec
[ 5] 5.81-5.90 sec 6.12 MBytes 543 Mbits/sec
[ 5] 5.90-6.01 sec 10.0 MBytes 805 Mbits/sec
[ 5] 6.01-6.10 sec 9.25 MBytes 813 Mbits/sec
[ 5] 6.10-6.20 sec 8.00 MBytes 663 Mbits/sec
[ 5] 6.20-6.31 sec 10.4 MBytes 838 Mbits/sec
[ 5] 6.31-6.41 sec 9.50 MBytes 825 Mbits/sec
[ 5] 6.41-6.50 sec 8.00 MBytes 696 Mbits/sec
[ 5] 6.50-6.61 sec 9.38 MBytes 719 Mbits/sec
[ 5] 6.61-6.70 sec 7.38 MBytes 660 Mbits/sec
[ 5] 6.70-6.81 sec 9.88 MBytes 774 Mbits/sec
[ 5] 6.81-6.91 sec 8.88 MBytes 769 Mbits/sec
[ 5] 6.91-7.00 sec 7.62 MBytes 688 Mbits/sec
[ 5] 7.00-7.11 sec 9.88 MBytes 774 Mbits/sec
[ 5] 7.11-7.20 sec 8.88 MBytes 795 Mbits/sec
[ 5] 7.20-7.30 sec 9.62 MBytes 791 Mbits/sec
[ 5] 7.30-7.40 sec 8.88 MBytes 750 Mbits/sec
[ 5] 7.40-7.50 sec 8.50 MBytes 724 Mbits/sec
[ 5] 7.50-7.61 sec 10.8 MBytes 845 Mbits/sec
[ 5] 7.61-7.71 sec 8.50 MBytes 740 Mbits/sec
[ 5] 7.71-7.81 sec 11.2 MBytes 872 Mbits/sec
[ 5] 7.81-7.91 sec 7.62 MBytes 677 Mbits/sec
[ 5] 7.91-8.00 sec 9.00 MBytes 802 Mbits/sec
[ 5] 8.00-8.11 sec 8.75 MBytes 679 Mbits/sec
[ 5] 8.11-8.20 sec 8.38 MBytes 768 Mbits/sec
[ 5] 8.20-8.30 sec 10.5 MBytes 854 Mbits/sec
[ 5] 8.30-8.40 sec 9.38 MBytes 800 Mbits/sec
[ 5] 8.40-8.50 sec 7.00 MBytes 603 Mbits/sec
[ 5] 8.50-8.60 sec 10.1 MBytes 817 Mbits/sec
[ 5] 8.60-8.70 sec 8.62 MBytes 746 Mbits/sec
[ 5] 8.70-8.80 sec 8.00 MBytes 678 Mbits/sec
[ 5] 8.80-8.90 sec 10.0 MBytes 815 Mbits/sec
[ 5] 8.90-9.00 sec 9.12 MBytes 791 Mbits/sec
[ 5] 9.00-9.10 sec 7.88 MBytes 631 Mbits/sec
[ 5] 9.10-9.20 sec 8.88 MBytes 780 Mbits/sec
[ 5] 9.20-9.30 sec 9.38 MBytes 764 Mbits/sec
[ 5] 9.30-9.40 sec 9.38 MBytes 792 Mbits/sec
[ 5] 9.40-9.50 sec 8.62 MBytes 720 Mbits/sec
[ 5] 9.50-9.61 sec 9.25 MBytes 710 Mbits/sec
[ 5] 9.61-9.71 sec 7.88 MBytes 705 Mbits/sec
[ 5] 9.71-9.81 sec 10.5 MBytes 846 Mbits/sec
[ 5] 9.81-9.91 sec 8.12 MBytes 711 Mbits/sec
[ 5] 9.91-10.00 sec 8.25 MBytes 714 Mbits/sec
[ 5] 10.00-10.02 sec 2.12 MBytes 937 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.02 sec 852 MBytes 713 Mbits/sec sender
-----------------------------------------------------------
</textarea>
<button onclick="applyIperf()">应用 Iperf 数据</button>
</div>
<div class="json">
<textarea id="json">
{
"title":"MacBook Pro: P4 位置",
"sender":[ 25.5,29.6,24.2,37.4,33.9,21.4,32.7,24.1,29.4,37.5,30.5,18.4,39.5,46.0,46.2,43.1,37.6,44.0,40.5,29.8,40.0,38.0,26.0,38.3,24.2,33.0,38.6,44.5,39.5,45.3,45.0,45.8,41.8,41.3,41.9,37.3,41.8,42.8,41.9,41.2,40.9,44.2,37.2,42.1,30.7,34.4,32.2,19.6,11.2,8.27,2.24,0.0,29.8,29.5,28.2,14.4,18.3,30.1,33.0,30.1,18.8,7.61,6.83,21.0,19.1,21.6,21.2,22.0,20.1,21.3,21.2,20.9,21.1,20.0,16.8,20.2,22.1,21.3,20.4,20.8,22.0,21.5,20.7,19.6,21.0,21.8,20.8,20.7,20.8,20.5,21.9,21.9,21.0,22.5,27.3,21.9,21.6,33.4,28.4,33.3,25.9 ],
"receiver":[ 21.0,0.0,21.0,10.5,10.4,10.5,21.0,20.9,21.0,31.5,20.9,21.1,41.9,62.8,31.4,42.0,63.1,73.6,62.6,115,63.2,105,93.9,83.9,168,105,63.2,147,126,126,63.0,136,73.7,62.5,147,94.6,21.1,73.3,83.9,62.5,10.5,0.0,42.0,0.0,0.0,0.0,83.6,0.0,42.2,0.0,0.0,73.6,31.4,73.5,41.9,94.0,84.3,41.7,116,157,83.9,157,83.6,84.2,137,156,84.2,168,230,116,167,116,105,199,115,157,105,126,116,198,178,105,126,127,146,232,146,126,73.3,179,158,167,157,147,84.1,221,135,147,84.5,210,120 ]
}
</textarea>
<button onclick="applyJson()">应用 JSON 数据</button>
</div>
</div>
<script>
Array.prototype.randomSort = function () {
const sortedArray = this.map(i => ({ v: i, k: Math.random() })).sort((a, b) => a.k - b.k).map(i => i.v);
return sortedArray;
};
const themeSand = {
chart: { width: 650, height: 400, backgroundColor: null, type: 'spline' },
credits: { text: 'made by 可爱的排骨', style: { fontSize: '12px' }, position: { verticalAlign: 'top', x: -50, y: 20 } },
title: { align: 'left', x: 30, style: { color: '#303030' } },
xAxis: { visible: false },
yAxis: [{ title: { text: '(Mbps)' }, min: 0 }, { title: { text: '' }, linkedTo: 0, opposite: true }],
plotOptions: { spline: { lineWidth: 3, marker: { enabled: false } }, series: { animation: { duration: 5000 }, shadow: true, enableMouseTracking: false } },
colors: ['#f45b5b', '#8085e9', '#8d4654', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', '#55BF3B', '#DF5353', '#7798BF'],
series: [{ name: '下行' }, { name: '上行' }],
navigation: { menuItemStyle: { fontSize: '10px' } }
};
const themeDark = {
// chart: { width: 650, height: 400, backgroundColor: '#3e3e40', type: 'spline' },
chart: { width: 650, height: 400, backgroundColor: null, type: 'spline' },
credits: { text: 'made by 可爱的排骨', style: { fontSize: '12px' }, position: { verticalAlign: 'top', x: -50, y: 20 } },
title: { align: 'left', x: 30, style: { color: '#E0E0E3' } },
legend: { itemStyle: { color: '#999' } },
xAxis: { visible: false },
yAxis: [{ title: { text: '(Mbps)' }, min: 0 }, { labels: { style: { color: '#999' } }, gridLineColor: '#999', title: { text: '' }, linkedTo: 0, opposite: true }],
plotOptions: { spline: { lineWidth: 3, marker: { enabled: false } }, series: { animation: { duration: 5000 }, shadow: { color: '#fff' }, enableMouseTracking: false } },
colors: ['#2b908f', '#90ee7e', '#f45b5b', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', '#55BF3B', '#DF5353', '#7798BF'],
// colors: [
// { linearGradient: [0, 0, 516, 0], stops: [[0, '#ccff90'], [1, '#0097a7']] },
// { linearGradient: [0, 0, 516, 0], stops: [[0, '#ffa000'], [1, '#d500f9']] }
// ],
series: [{ name: '下行' }, { name: '上行' }],
navigation: { buttonOptions: { symbolStroke: '#DDDDDD', theme: { fill: '#505053' } } }
};
let chart1, chart2;
const createChart = (data) => {
console.log(data);
if (chart1) {
clearTimeout(chart1.timeout);
chart1.destroy();
clearTimeout(chart2.timeout);
chart2.destroy();
}
const theme = document.getElementById('theme').value === 'sand' ? themeSand : themeDark;
const colors = theme.colors;//.randomSort();
data.sender.pop();
data.sender.shift();
data.receiver.pop();
data.receiver.shift();
Highcharts.setOptions(theme);
chart1 = Highcharts.chart('container1', {
title: { text: `AX3 Pro 速度测试 (${data.title})` },
colors,
series: [{ name: '下行', data: data.sender }, { name: '上行', data: data.receiver }]
});
chart1.timeout = setTimeout(() => { updateSeriesName(chart1.series[0]); updateSeriesName(chart1.series[1]); chart1.redraw(false); }, 5000);
const [sender, receiver] = [reduceData(data.sender, 10), reduceData(data.receiver, 10)];
console.log(sender, receiver);
chart2 = Highcharts.chart('container2', {
title: { text: `AX3 Pro 速度测试 (${data.title})` },
colors,
series: [{ name: '下行', data: sender }, { name: '上行', data: receiver }]
});
chart2.timeout = setTimeout(() => { updateSeriesName(chart2.series[0]); updateSeriesName(chart2.series[1]); chart2.redraw(false); }, 5000);
};
const updateSeriesName = (series) => {
let avg = series.yData.reduce((a, c) => a + c, 0) / series.yData.length;
series.update({ name: `${series.name}: ${avg.toFixed(1)}Mbps` }, false);
};
const reduceData = (arr, n) => {
const newArr = Array(Math.ceil(arr.length / n)).fill().map((v, i) => arr.slice(i * n, (i + 1) * n));
return newArr.map(i => i.reduce((a, c) => a + c, 0) / (i.length > n ? n : i.length));
};
const applyJson = () => {
const data = JSON.parse(document.getElementById('json').value);
createChart(data);
};
const applyIperf = () => {
const text = document.getElementById('iperf').value;
const lines = text.split('\n');
let sender, receiver, values = [];
for (let i = 1; i < lines.length; i++) {
const line = lines[i].trim();
console.log(line.slice(0, 8) === '[ 5] ');
if(line.startsWith('[ 5] local')) {
continue;
} else if (line === '- - - - - - - - - - - - - - - - - - - - - - - - -') {
const endLine = lines[i + 2].trim();
const direction = endLine.split(' ').pop();
switch (direction) {
case 'sender':
sender = [...values];
break;
case 'receiver':
receiver = [...values];
break;
default:
break;
}
values.length = 0;
} else if (line.startsWith('[ 5]')) {
const columns = line.split(' ').filter((c) => c.trim().length > 0);
values.push(parseFloat(columns[6]));
}
}
createChart({ title: lines[0], sender, receiver });
};
</script>
</body>
</html>