-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSRH 可视化.html
450 lines (416 loc) · 14.3 KB
/
SRH 可视化.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
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>风暴相对螺旋度可视化</title>
<link rel="icon" href="./Essential/images/LOGO.png">
<link rel="stylesheet" type="text/css" href="./Essential/style.css">
<script src="./Essential/echarts.js"></script>
<script type="text/javascript" src="./Essential/jquery-1.11.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="./Essential/moment-timezone-with-data.js"></script>
<style>
.container {
padding-top: 3rem;
padding-bottom: 1rem;
padding-right: 1.5rem;
padding-left: 1.5rem;
max-width: 720px;
margin-right: auto;
margin-left: auto;
display: block;
box-sizing: border-box;
}
.card{
margin-top: 3rem;
margin-bottom: 3rem;
border: 0;
border-radius: .35rem;
background-color: #fff;
display: block;
box-sizing: border-box;
}
.card-body{
-webkit-box-flex: 1;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
padding: 1.25rem;
padding: 0;
display: block;
box-sizing: border-box;
}
.row{
position: relative;
padding-right: 3.75rem;
padding-left: 3.75rem;
padding-bottom: 3rem;
padding-top: 3rem;
width: 100%;
display: block;
box-sizing: border-box;
}
.user{
display: block;
box-sizing: border-box;
}
form{
display: block;
margin-top: 0em;
box-sizing: border-box;
}
.form-group{
margin-bottom: 1rem;
display: block;
box-sizing: border-box;
}
.form-control {
padding-top: .75rem;
padding-bottom: .75rem;
padding-left: 1rem;
border-radius: 10rem;
font-size: .8rem;
display: block;
width: calc(100% - 1rem);
height: calc(1.5em + .75rem + 2px);
border: 1px solid #d1d3e2;
background-color: #fff;
background-clip: padding-box;
color: #6e707e;
font-weight: 400;
line-height: 1.5;
}
.form-custom {
padding-top: 1.15rem;
/* padding-bottom: .75rem; */
padding-left: 2rem;
border-radius: 10rem;
font-size: .8rem;
display: block;
width: calc(100% - 1rem);
height: calc(1.5em + .75rem + 2px);
border: 1px solid #d1d3e2;
background-color: #fff;
color: #6e707e;
font-weight: 400;
line-height: 1.5;
}
.button {
padding: .75rem 1rem;
border-radius: 10rem;
font-size: 1rem;
cursor: pointer;
display: table-cell;
border-color: #4e73df;
border: 1px solid transparent;
text-align: center;
font-weight: 400;
line-height: 1.5;
margin-left: 0.25rem;
margin-right: 0.25rem;
width: calc( 55% - 2.5rem);
}
.login_button {
border-color: #4e73df;
border: 1px solid transparent;
text-align: center;
font-weight: 400;
line-height: 1.5;
width: 100%;
background-color: #4e73df;
color: #fff;
}
a{
text-decoration: none;
}
</style>
</head>
<body class="menu">
<div class="header small">
<center>
<div class="inner">
<h0 style="margin-left: 7%;"><img src="./Essential/images/LOGO.png" alt="logo"></h0>
<ul class="nav" style="float: left;">
<li style="font-weight: 500;"><a href="#" title="风廓线雷达工具包">风廓线雷达工具包</a></li>
</ul>
<ul class="nav" style="float: right;">
<li style="font-weight: 800; color: #000000"><a href="./SRH 可视化.html" title="SRH 可视化">SRH 数据可视化</a></li>
<li style="color: #888888"><a href="./垂直速度显示程序.html" title="垂直速度">垂直速度</a></li>
<li style="color: #888888"><a href="./水平速度显示程序.html" title="水平速度">水平速度</a></li>
<li style="color: #888888"><a href="./大气折射指数.html" title="大气折射指数">大气折射指数</a></li>
<li style="color: #888888"><a href="./转换程序.html" title="转换程序">增补自动站数据</a></li>
</ul>
</div>
</center>
</div>
<main class="main">
<div class="container" id="loadfile">
<div class="card">
<div class="card-body">
<div class="row">
<div style="text-align: center;">
<h1 class="h4" style="margin-bottom: 1.5rem; color:#333">加载绘图文件</h1>
</div>
<form class="user" id="registration_form">
<div class="form-group">
<a class="form-custom">
请选择文件:<input type="file" id="inputFile" onchange="readFile(this);" accept="text/csv">
</a>
</div>
<div style="display: table; position: relative; align-self: center; width: 100%;">
<button type="button" class="button" id="submitForm" onclick="getData();" style="background-color: #4e73df;color: #fff;">提交</button>
<button type="clear" class="button" id="resetForm" οnclick="formReset()" style="background-color: #EEE;color: #333; float: right;">重置</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="ChartPanel" style="display:none">
<center><div id="chart" style="width: 1200; height:500; padding-top: 8%; padding-bottom: 5%;"></div><center>
</div>
</main>
<footer>
<div class="footer-content">
<div class="final">
<ul>
<li>Created by Tianyang Xu.</li>
<li>Commissioned by Qingdao Weather Station.</li>
<li>Personal use only.</li>
</ul>
</div>
<span class="thanks">
<em></em>
</span>
<div class="final final_with_top_hr">
<div class="copyright">Copyright © 2020 Dylan Xu
<br class="plus">All rights reserved.</div>
<div class="language">
<a href="https://github.com/Architect1st/">Github</a>
</div>
</div>
</div>
</footer>
</body>
<script type="text/javascript">
function getFileName(o){
var pos=o.lastIndexOf("\\");
return o.substring(pos+1);
}
function toTimeZone(time) {
var format = 'YYYY/MM/DD HH:mm:ss ZZ';
var returnFormat = 'YYYY/MM/DD HH:mm';
return moment(time, format).tz("Asia/Shanghai").format(returnFormat);
}
var result = [];
function readFile(input){
var file = input.files[0];
var reader = new FileReader();
reader.readAsText(file,'utf-8');
reader.onloadend = function() {
var fileContent=this.result;
var arrLine=fileContent.split("\n");
arrLine.map(i => {
let = item = i.split(" ").join("").split(",");
if (item[0] != ""){
// new Date("2016/08/03 00:00:00");
var yearArr = []
yearArr.push(item[0][0]);
yearArr.push(item[0][1]);
yearArr.push(item[0][2]);
yearArr.push(item[0][3]);
var year = yearArr.join("");
// "2020"
var monthArr = []
monthArr.push(item[0][4]);
monthArr.push(item[0][5]);
var month = monthArr.join("");
// "11"
var dayArr = [];
dayArr.push(item[0][6]);
dayArr.push(item[0][7]);
var day = dayArr.join("");
//"05"
var time = item[1].trim();
//"21:26"
var timestringArr = [];
timestringArr.push(year);
timestringArr.push("/");
timestringArr.push(month);
timestringArr.push("/");
timestringArr.push(day);
timestringArr.push(" ");
timestringArr.push(time);
timestringArr.push(":00 +0800");
var timestring = timestringArr.join("");
// "2020/11/06 21:26:00"
// console.log(timestring)
// new Date(timestring);
// var timestamp = new Date(timestring).getTime();
// console.log(timestamp)
// var timestamp = Date.parse(Date(timestring));
//Fri Nov 06 2020 21:26:00 GMT+0800 (CST)
var CSTtime = toTimeZone(timestring);
result.push({
"time": CSTtime,
"t_btm": parseFloat(item[2]),
"t_mdl": parseFloat(item[3]),
"t_top": parseFloat(item[4]),
"p_QD": parseFloat(item[5]),
"p_JZ": parseFloat(item[6]),
});
}
})
console.log(result)
console.log(JSON.stringify(result))
}
}
// var data = [
// {value:['2016/12/18 6:38:08', 80]},
// {value:['2016/12/18 16:18:18', 60]},
// {value:['2016/12/18 19:18:18', 90]}
// ];
function doChart(result){
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('chart'));
// 指定图表的配置项和数据
var option = {
color:['#4DC85D','#FF6868','#4AA8FF','#C58AD5','#F7B500'],
dataset: {
// 这里指定了维度名的顺序,从而可以利用默认的维度到坐标轴的映射。
// 如果不指定 dimensions,也可以通过指定 series.encode 完成映射,参见后文。
dimensions: ['time', 't_btm', 't_mdl', 't_top', 'p_QD', 'p_JZ'],
source: result,
},
title: {
text: result.title,
// subtext: 'SRH 在不同高度区间上随时间的变化',
left: 20,
// padding: 5,
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['0-2 KM', '2-5 KM', '5-14 KM', '青岛降水量', '胶州降水量' ],
// left: 20
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
dataZoom: [{
type: 'inside'
}, {
type: 'slider'
}],
xAxis: {
type: 'category',
// type: 'time',
// boundaryGap: false,
splitLine: {
show: true,
lineStyle:{
type:'dotted' //设置网格线类型 dotted:虚线 solid:实线 dashed
},
},
// data: result.time
},
yAxis: [
{
type: 'value',
name: 'SRH',
axisLabel: {
formatter: '{value} m²/s²'
},
minorSplitLine:{
show: true,
},
splitLine: {
show: true,
lineStyle:{
type:'dotted' //设置网格线类型 dotted:虚线 solid:实线
},
},
},
{
type: 'value',
name: '降水量',
axisLabel: {
formatter: '{value} mm'
}
}
],
series: [
{
name: '0-2 KM',
type: 'line',
symbol: 'none',
lineStyle:{color:'#4DC85D'},
data : result.t_btm,
},
{
name: '2-5 KM',
type: 'line',
symbol: 'none',
lineStyle:{color:'#FF6868'},
data : result.t_mdl,
},
{
name: '5-14 KM',
type: 'line',
symbol: 'none',
lineStyle:{color:'#4AA8FF'},
data : result.t_top,
markLine: {
silent: true,
data: [{yAxis: 100},{yAxis: 200}],
lineStyle: {type: 'solid', color:'#000000'},
}
},
{
name: '青岛降水量',
type: 'bar',
barWidth:'3',
yAxisIndex: 1,
lineStyle:{color:'#C58AD5'},//C58AD5
data : result.p_QD
},
{
name: '胶州降水量',
type: 'bar',
barWidth:'3',
yAxisIndex: 1,
lineStyle:{color:'#F7B500'},//C58AD5
data : result.p_JZ
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
function unique(arr) {return Array.from(new Set(arr))}
function getData(){
// for (i = 0; i < result.length; i++) {
// data.push(result[i]);
// data[i].name = result[i].name.substring(10, 18);
// }
var FileName = $("#inputFile").val();
if (FileName != ""){
var Title = getFileName(FileName).split(".");
}
console.log(result)
console.log(JSON.stringify(result))
var t = document.getElementById('loadfile');
t.style.display = 'none'; // 隐藏
doChart(result);
var c = document.getElementById('ChartPanel');
c.style.display = 'block'; // 显示图表
}
</script>
</html>