Showing
1 changed file
with
62 additions
and
85 deletions
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | - <head> | 3 | + |
4 | +<head> | ||
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | <meta name="viewport" content="width=device-width, initial-scale=1" /> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
6 | <title>Highcharts Example</title> | 7 | <title>Highcharts Example</title> |
7 | 8 | ||
8 | <style type="text/css"></style> | 9 | <style type="text/css"></style> |
9 | - </head> | 10 | +</head> |
10 | - <body> | 11 | + |
12 | +<body> | ||
11 | <script src="highcharts.js"></script> | 13 | <script src="highcharts.js"></script> |
12 | <script src="modules/exporting.js"></script> | 14 | <script src="modules/exporting.js"></script> |
13 | <script src="modules/export-data.js"></script> | 15 | <script src="modules/export-data.js"></script> |
14 | 16 | ||
15 | - <div | 17 | + <div id="container1" style="width:1260px; height: 400px; margin: 0 auto"></div> |
16 | - id="container1" | ||
17 | - style="width:1260px; height: 400px; margin: 0 auto" | ||
18 | - ></div> | ||
19 | 18 | ||
20 | <div style="width:1275px; margin:0 auto;"> | 19 | <div style="width:1275px; margin:0 auto;"> |
21 | <div style="display: inline-block;"> | 20 | <div style="display: inline-block;"> |
22 | - <div | 21 | + <div id="container2" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> |
23 | - id="container2" | ||
24 | - style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;" | ||
25 | - ></div> | ||
26 | </div> | 22 | </div> |
27 | <div style="display: inline-block;"> | 23 | <div style="display: inline-block;"> |
28 | - <div | 24 | + <div id="container3" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> |
29 | - id="container3" | ||
30 | - style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;" | ||
31 | - ></div> | ||
32 | </div> | 25 | </div> |
33 | 26 | ||
34 | <div style="display: inline-block;"> | 27 | <div style="display: inline-block;"> |
35 | - <div | 28 | + <div id="container4" style="width:400px; height: 300px; padding:0; margin-left:0px;"></div> |
36 | - id="container4" | ||
37 | - style="width:400px; height: 300px; padding:0; margin-left:0px;" | ||
38 | - ></div> | ||
39 | </div> | 29 | </div> |
40 | </div> | 30 | </div> |
41 | 31 | ||
42 | 32 | ||
43 | -<script src="/socket.io/socket.io.js"></script> | 33 | + <script src="/socket.io/socket.io.js"></script> |
44 | -<script> | 34 | + <script type="text/javascript"> |
45 | - var socket = io.connect('/',{transports: ['websocket'],upgrade:false}); | 35 | + var socket = io.connect('/', { transports: ['websocket'], upgrade: false }); |
46 | - socket.emit("connection","client in"); | 36 | + socket.emit("connection", "client in"); |
47 | - socket.on("weatherInfo_minutely_send_to_client",(info)=>{ //서버에서 client에게 메세지 전송 | 37 | + socket.on("weatherInfo_minutely_send_to_client", (info) => { //서버에서 client에게 메세지 전송 |
48 | console.log(info); | 38 | console.log(info); |
39 | + | ||
49 | }); | 40 | }); |
50 | -</script> | 41 | + |
51 | - <!-- 첫번째 그래프 --> | 42 | + var chart1 = Highcharts.chart("container1", { |
52 | - <script type="text/javascript"> | ||
53 | - Highcharts.chart("container1", { | ||
54 | chart: { | 43 | chart: { |
55 | type: "areaspline", | 44 | type: "areaspline", |
56 | animation: Highcharts.svg, // don't animate in old IE | 45 | animation: Highcharts.svg, // don't animate in old IE |
57 | marginRight: 10, | 46 | marginRight: 10, |
58 | events: { | 47 | events: { |
59 | - load: function() { | 48 | + load: function () { |
60 | // set up the updating of the chart each second | 49 | // set up the updating of the chart each second |
61 | var series = this.series[0]; | 50 | var series = this.series[0]; |
62 | - setInterval(function() { | 51 | + setInterval(function () { |
63 | var x = new Date().getTime(), // 현재 시간 | 52 | var x = new Date().getTime(), // 현재 시간 |
64 | y = 0; //여기에 새로 넣을 값 | 53 | y = 0; //여기에 새로 넣을 값 |
65 | series.addPoint([x, y], true, true); | 54 | series.addPoint([x, y], true, true); |
... | @@ -114,14 +103,13 @@ | ... | @@ -114,14 +103,13 @@ |
114 | series: [ | 103 | series: [ |
115 | { | 104 | { |
116 | name: "사망률", | 105 | name: "사망률", |
117 | - data: (function() { | 106 | + data: (function () { |
118 | var deathArr = [], | 107 | var deathArr = [], |
119 | time = new Date().getTime(); | 108 | time = new Date().getTime(); |
120 | - var length= <%=dataLen%>; | 109 | + var length = <%=dataLen%>; |
121 | - var i=-9; //얘는 시간계산용 | 110 | + var i = -9; //얘는 시간계산용 |
122 | - var j=0; //얘는 반복문용 | 111 | + var j = 0; //얘는 반복문용 |
123 | - for(;j<10-length;j++) | 112 | + for (; j < 10 - length; j++) { |
124 | - { | ||
125 | deathArr.push({ | 113 | deathArr.push({ |
126 | x: time + i * 60000, | 114 | x: time + i * 60000, |
127 | y: 0 | 115 | y: 0 |
... | @@ -129,9 +117,9 @@ | ... | @@ -129,9 +117,9 @@ |
129 | i++; | 117 | i++; |
130 | } | 118 | } |
131 | 119 | ||
132 | - <%probArr.forEach((probArr)=>{%> | 120 | + <% probArr.forEach((probArr) => {%> |
133 | var temp; | 121 | var temp; |
134 | - temp= <%=probArr%>; | 122 | + temp = <%=probArr %>; |
135 | 123 | ||
136 | // for(;j<10;j++) | 124 | // for(;j<10;j++) |
137 | // { | 125 | // { |
... | @@ -148,27 +136,24 @@ | ... | @@ -148,27 +136,24 @@ |
148 | }) | 136 | }) |
149 | i++; | 137 | i++; |
150 | 138 | ||
151 | - <%})%> | 139 | + <%}) %> |
152 | 140 | ||
153 | return deathArr; | 141 | return deathArr; |
154 | })() | 142 | })() |
155 | } | 143 | } |
156 | ] | 144 | ] |
157 | }); | 145 | }); |
158 | - </script> | ||
159 | 146 | ||
160 | - <!-- 두번째 그래프 --> | 147 | + var chart2 = Highcharts.chart("container2", { |
161 | - <script type="text/javascript"> | ||
162 | - Highcharts.chart("container2", { | ||
163 | chart: { | 148 | chart: { |
164 | type: "spline", | 149 | type: "spline", |
165 | animation: Highcharts.svg, // don't animate in old IE | 150 | animation: Highcharts.svg, // don't animate in old IE |
166 | marginRight: 10, | 151 | marginRight: 10, |
167 | events: { | 152 | events: { |
168 | - load: function() { | 153 | + load: function () { |
169 | // set up the updating of the chart each second | 154 | // set up the updating of the chart each second |
170 | var series = this.series[0]; | 155 | var series = this.series[0]; |
171 | - setInterval(function() { | 156 | + setInterval(function () { |
172 | var x = new Date().getTime(), // 현재 시간 | 157 | var x = new Date().getTime(), // 현재 시간 |
173 | y = 0; // | 158 | y = 0; // |
174 | series.addPoint([x, y], true, true); | 159 | series.addPoint([x, y], true, true); |
... | @@ -223,14 +208,13 @@ | ... | @@ -223,14 +208,13 @@ |
223 | series: [ | 208 | series: [ |
224 | { | 209 | { |
225 | name: "기온", | 210 | name: "기온", |
226 | - data: (function() { | 211 | + data: (function () { |
227 | var tempArr = [], | 212 | var tempArr = [], |
228 | time = new Date().getTime(); | 213 | time = new Date().getTime(); |
229 | - var length= <%=dataLen%>; | 214 | + var length = <%=dataLen%>; |
230 | - var i=-9; | 215 | + var i = -9; |
231 | - var j=0; | 216 | + var j = 0; |
232 | - for(j;j<10-length;j++) | 217 | + for (j; j < 10 - length; j++) { |
233 | - { | ||
234 | tempArr.push({ | 218 | tempArr.push({ |
235 | x: time + i * 60000, | 219 | x: time + i * 60000, |
236 | y: 0 | 220 | y: 0 |
... | @@ -238,9 +222,9 @@ | ... | @@ -238,9 +222,9 @@ |
238 | i++; | 222 | i++; |
239 | } | 223 | } |
240 | 224 | ||
241 | - <%ptArr.forEach((ptArr)=>{%> | 225 | + <% ptArr.forEach((ptArr) => {%> |
242 | var temp; | 226 | var temp; |
243 | - temp= <%=ptArr%>; | 227 | + temp = <%=ptArr %>; |
244 | 228 | ||
245 | // for(j;j<10;j++) | 229 | // for(j;j<10;j++) |
246 | // { | 230 | // { |
... | @@ -257,27 +241,24 @@ | ... | @@ -257,27 +241,24 @@ |
257 | }) | 241 | }) |
258 | i++; | 242 | i++; |
259 | 243 | ||
260 | - <%})%> | 244 | + <%}) %> |
261 | 245 | ||
262 | return tempArr; | 246 | return tempArr; |
263 | })() | 247 | })() |
264 | } | 248 | } |
265 | ] | 249 | ] |
266 | }); | 250 | }); |
267 | - </script> | ||
268 | 251 | ||
269 | - <!-- 세번째 그래프 --> | 252 | + var chart3 = Highcharts.chart("container3", { |
270 | - <script type="text/javascript"> | ||
271 | - Highcharts.chart("container3", { | ||
272 | chart: { | 253 | chart: { |
273 | type: "spline", | 254 | type: "spline", |
274 | animation: Highcharts.svg, // don't animate in old IE | 255 | animation: Highcharts.svg, // don't animate in old IE |
275 | marginRight: 10, | 256 | marginRight: 10, |
276 | events: { | 257 | events: { |
277 | - load: function() { | 258 | + load: function () { |
278 | // set up the updating of the chart each second | 259 | // set up the updating of the chart each second |
279 | var series = this.series[0]; | 260 | var series = this.series[0]; |
280 | - setInterval(function() { | 261 | + setInterval(function () { |
281 | var x = new Date().getTime(), // 현재 시간 | 262 | var x = new Date().getTime(), // 현재 시간 |
282 | y = 0; // | 263 | y = 0; // |
283 | series.addPoint([x, y], true, true); | 264 | series.addPoint([x, y], true, true); |
... | @@ -332,14 +313,13 @@ | ... | @@ -332,14 +313,13 @@ |
332 | series: [ | 313 | series: [ |
333 | { | 314 | { |
334 | name: "풍속", | 315 | name: "풍속", |
335 | - data: (function() { | 316 | + data: (function () { |
336 | var windArr = [], | 317 | var windArr = [], |
337 | time = new Date().getTime(); | 318 | time = new Date().getTime(); |
338 | - var length= <%=dataLen%>; | 319 | + var length = <%=dataLen%>; |
339 | - var i=-9; | 320 | + var i = -9; |
340 | - var j=0; | 321 | + var j = 0; |
341 | - for(j;j<10-length;j++) | 322 | + for (j; j < 10 - length; j++) { |
342 | - { | ||
343 | windArr.push({ | 323 | windArr.push({ |
344 | x: time + i * 60000, | 324 | x: time + i * 60000, |
345 | y: 0 | 325 | y: 0 |
... | @@ -347,9 +327,9 @@ | ... | @@ -347,9 +327,9 @@ |
347 | i++; | 327 | i++; |
348 | } | 328 | } |
349 | 329 | ||
350 | - <%wsArr.forEach((wsArr)=>{%> | 330 | + <% wsArr.forEach((wsArr) => {%> |
351 | var temp; | 331 | var temp; |
352 | - temp= <%=wsArr%>; | 332 | + temp = <%=wsArr %>; |
353 | 333 | ||
354 | // for(j;j<10;j++) | 334 | // for(j;j<10;j++) |
355 | // { | 335 | // { |
... | @@ -366,27 +346,24 @@ | ... | @@ -366,27 +346,24 @@ |
366 | }) | 346 | }) |
367 | i++; | 347 | i++; |
368 | 348 | ||
369 | - <%})%> | 349 | + <%}) %> |
370 | 350 | ||
371 | return windArr; | 351 | return windArr; |
372 | })() | 352 | })() |
373 | } | 353 | } |
374 | ] | 354 | ] |
375 | }); | 355 | }); |
376 | - </script> | ||
377 | 356 | ||
378 | - <!-- 네번째 그래프 --> | 357 | + var chart4 = Highcharts.chart("container4", { |
379 | - <script type="text/javascript"> | ||
380 | - Highcharts.chart("container4", { | ||
381 | chart: { | 358 | chart: { |
382 | type: "spline", | 359 | type: "spline", |
383 | animation: Highcharts.svg, // don't animate in old IE | 360 | animation: Highcharts.svg, // don't animate in old IE |
384 | marginRight: 10, | 361 | marginRight: 10, |
385 | events: { | 362 | events: { |
386 | - load: function() { | 363 | + load: function () { |
387 | // set up the updating of the chart each second | 364 | // set up the updating of the chart each second |
388 | var series = this.series[0]; | 365 | var series = this.series[0]; |
389 | - setInterval(function() { | 366 | + setInterval(function () { |
390 | var x = new Date().getTime(), // 현재 시간 | 367 | var x = new Date().getTime(), // 현재 시간 |
391 | y = 0; // | 368 | y = 0; // |
392 | series.addPoint([x, y], true, true); | 369 | series.addPoint([x, y], true, true); |
... | @@ -441,14 +418,13 @@ | ... | @@ -441,14 +418,13 @@ |
441 | series: [ | 418 | series: [ |
442 | { | 419 | { |
443 | name: "강수량", | 420 | name: "강수량", |
444 | - data: (function() { | 421 | + data: (function () { |
445 | var rainArr = [], | 422 | var rainArr = [], |
446 | time = new Date().getTime(); | 423 | time = new Date().getTime(); |
447 | - var length= <%=dataLen%>; | 424 | + var length = <%=dataLen%>; |
448 | - var i=-9; | 425 | + var i = -9; |
449 | - var j=0; | 426 | + var j = 0; |
450 | - for(j;j<10-length;j++) | 427 | + for (j; j < 10 - length; j++) { |
451 | - { | ||
452 | rainArr.push({ | 428 | rainArr.push({ |
453 | x: time + i * 60000, | 429 | x: time + i * 60000, |
454 | y: 0 | 430 | y: 0 |
... | @@ -456,9 +432,9 @@ | ... | @@ -456,9 +432,9 @@ |
456 | i++; | 432 | i++; |
457 | } | 433 | } |
458 | 434 | ||
459 | - <%rainArr.forEach((rainArr)=>{%> | 435 | + <% rainArr.forEach((rainArr) => {%> |
460 | var temp; | 436 | var temp; |
461 | - temp= <%=rainArr%>; | 437 | + temp = <%=rainArr %>; |
462 | 438 | ||
463 | // for(j;j<10;j++) | 439 | // for(j;j<10;j++) |
464 | // { | 440 | // { |
... | @@ -475,7 +451,7 @@ | ... | @@ -475,7 +451,7 @@ |
475 | }) | 451 | }) |
476 | i++; | 452 | i++; |
477 | 453 | ||
478 | - <%})%> | 454 | + <%}) %> |
479 | 455 | ||
480 | return rainArr; | 456 | return rainArr; |
481 | })() | 457 | })() |
... | @@ -483,5 +459,6 @@ | ... | @@ -483,5 +459,6 @@ |
483 | ] | 459 | ] |
484 | }); | 460 | }); |
485 | </script> | 461 | </script> |
486 | - </body> | 462 | +</body> |
463 | + | ||
487 | </html> | 464 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment