Showing
1 changed file
with
429 additions
and
428 deletions
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | - <head> | 3 | + |
4 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 | +<head> |
5 | - <meta name="viewport" content="width=device-width, initial-scale=1" /> | 5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
6 | - <title>Highcharts Example</title> | 6 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
7 | - | 7 | + <title>Highcharts Example</title> |
8 | - <style type="text/css"></style> | 8 | + |
9 | - </head> | 9 | + <style type="text/css"></style> |
10 | - <body> | 10 | +</head> |
11 | - <script src="highcharts.js"></script> | 11 | + |
12 | - <script src="modules/exporting.js"></script> | 12 | +<body> |
13 | - <script src="modules/export-data.js"></script> | 13 | + <script src="highcharts.js"></script> |
14 | - | 14 | + <script src="modules/exporting.js"></script> |
15 | - <div | 15 | + <script src="modules/export-data.js"></script> |
16 | - id="container1" | 16 | + |
17 | - style="width:1260px; height: 400px; margin: 0 auto" | 17 | + <div id="container1" style="width:1260px; height: 400px; margin: 0 auto"></div> |
18 | - ></div> | 18 | + |
19 | - | 19 | + <div style="width:1275px; margin:0 auto;"> |
20 | - <div style="width:1275px; margin:0 auto;"> | 20 | + <div style="display: inline-block;"> |
21 | - <div style="display: inline-block;"> | 21 | + <div id="container2" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> |
22 | - <div | 22 | + </div> |
23 | - id="container2" | 23 | + <div style="display: inline-block;"> |
24 | - style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;" | 24 | + <div id="container3" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> |
25 | - ></div> | 25 | + </div> |
26 | - </div> | 26 | + |
27 | - <div style="display: inline-block;"> | 27 | + <div style="display: inline-block;"> |
28 | - <div | 28 | + <div id="container4" style="width:400px; height: 300px; padding:0; margin-left:0px;"></div> |
29 | - id="container3" | ||
30 | - style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;" | ||
31 | - ></div> | ||
32 | - </div> | ||
33 | - | ||
34 | - <div style="display: inline-block;"> | ||
35 | - <div | ||
36 | - id="container4" | ||
37 | - style="width:400px; height: 300px; padding:0; margin-left:0px;" | ||
38 | - ></div> | ||
39 | - </div> | ||
40 | </div> | 29 | </div> |
30 | + </div> | ||
31 | + | ||
32 | + | ||
33 | + <script src="/socket.io/socket.io.js"></script> | ||
34 | + <script> | ||
35 | + var socket = io.connect('/', { transports: ['websocket'], upgrade: false }); | ||
36 | + socket.emit("connection", "client in"); | ||
37 | + socket.on("weatherInfo_minutely_send_to_client", (info) => { //서버에서 client에게 메세지 전송 | ||
38 | + console.log(info); | ||
39 | + | ||
40 | + var date = new Date().getTime(); | ||
41 | + | ||
42 | + chart1.series[0].addPoint({ | ||
43 | + x: date, | ||
44 | + y: info.death | ||
45 | + }) | ||
46 | + | ||
47 | + chart2.series[0].addPoint({ | ||
48 | + x: date, | ||
49 | + y: info.temperature | ||
50 | + }) | ||
51 | + | ||
52 | + chart3.series[0].addPoint({ | ||
53 | + x: date, | ||
54 | + y: info.wind | ||
55 | + }) | ||
56 | + | ||
57 | + chart4.series[0].addPoint({ | ||
58 | + x: date, | ||
59 | + y: info.rain | ||
60 | + }) | ||
41 | 61 | ||
42 | - | ||
43 | -<script src="/socket.io/socket.io.js"></script> | ||
44 | -<script> | ||
45 | - let client_data={ | ||
46 | - birth : "<%=birth%>", | ||
47 | - name : "<%=name%>" | ||
48 | - } | ||
49 | - var socket = io.connect('/',{transports: ['websocket'],upgrade:false}); | ||
50 | - socket.emit("connection",client_data); | ||
51 | - socket.on("weatherInfo_minutely_send_to_client",(info)=>{ //서버에서 client에게 메세지 전송 | ||
52 | - console.log(info); | ||
53 | }); | 62 | }); |
54 | -</script> | 63 | + </script> |
55 | - <!-- 첫번째 그래프 --> | ||
56 | <script type="text/javascript"> | 64 | <script type="text/javascript"> |
57 | - Highcharts.chart("container1", { | 65 | + //사망률 |
58 | - chart: { | 66 | + var chart1 = Highcharts.chart("container1", { |
59 | - type: "areaspline", | 67 | + chart: { |
60 | - animation: Highcharts.svg, // don't animate in old IE | 68 | + type: "areaspline", |
61 | - marginRight: 10, | 69 | + animation: Highcharts.svg, // don't animate in old IE |
62 | - events: { | 70 | + marginRight: 10, |
63 | - load: function() { | 71 | + // events: { |
64 | - // set up the updating of the chart each second | 72 | + // load: function () { |
65 | - var series = this.series[0]; | 73 | + // // set up the updating of the chart each second |
66 | - setInterval(function() { | 74 | + // var series = this.series[0]; |
67 | - var x = new Date().getTime(), // 현재 시간 | 75 | + // setInterval(function () { |
68 | - y = 0; //여기에 새로 넣을 값 | 76 | + // var x = new Date().getTime(), // 현재 시간 |
69 | - series.addPoint([x, y], true, true); | 77 | + // y = 0; //여기에 새로 넣을 값 |
70 | - }, 60000); //1000=1초 -> 1분=60000 | 78 | + // series.addPoint([x, y], true, true); |
71 | - } | 79 | + // }, 60000); //1000=1초 -> 1분=60000 |
72 | - } | 80 | + // } |
73 | - }, | 81 | + // } |
82 | + }, | ||
74 | 83 | ||
75 | - time: { | 84 | + time: { |
76 | - useUTC: false | 85 | + useUTC: false |
77 | - }, | 86 | + }, |
78 | 87 | ||
88 | + title: { | ||
89 | + text: "실시간 사망률" | ||
90 | + }, | ||
91 | + xAxis: { | ||
92 | + type: "datetime", | ||
93 | + tickPixelInterval: 150 | ||
94 | + }, | ||
95 | + yAxis: { | ||
79 | title: { | 96 | title: { |
80 | text: "<%=name%>님의 실시간 사망률" | 97 | text: "<%=name%>님의 실시간 사망률" |
81 | }, | 98 | }, |
... | @@ -83,409 +100,393 @@ | ... | @@ -83,409 +100,393 @@ |
83 | type: "datetime", | 100 | type: "datetime", |
84 | tickPixelInterval: 150 | 101 | tickPixelInterval: 150 |
85 | }, | 102 | }, |
86 | - yAxis: { | 103 | + plotLines: [ |
87 | - title: { | ||
88 | - text: "Value" | ||
89 | - }, | ||
90 | - plotLines: [ | ||
91 | - { | ||
92 | - value: 0, | ||
93 | - width: 1, | ||
94 | - color: "#808080" | ||
95 | - } | ||
96 | - ] | ||
97 | - }, | ||
98 | - tooltip: { | ||
99 | - headerFormat: "<b>{series.name}</b><br/>", | ||
100 | - pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" | ||
101 | - }, | ||
102 | - legend: { | ||
103 | - //enabled: false | ||
104 | - layout: "vertical", | ||
105 | - align: "left", | ||
106 | - verticalAlign: "top", | ||
107 | - x: 120, | ||
108 | - y: 70, | ||
109 | - floating: true, | ||
110 | - borderWidth: 1, | ||
111 | - backgroundColor: | ||
112 | - (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
113 | - "#FFFFFF" | ||
114 | - }, | ||
115 | - exporting: { | ||
116 | - enabled: false | ||
117 | - }, | ||
118 | - series: [ | ||
119 | { | 104 | { |
120 | - name: "사망률", | 105 | + value: 0, |
121 | - data: (function() { | 106 | + width: 1, |
122 | - var deathArr = [], | 107 | + color: "#808080" |
123 | - time = new Date().getTime(); | 108 | + } |
124 | - var length= <%=dataLen%>; | 109 | + ] |
125 | - var i=-9; //얘는 시간계산용 | 110 | + }, |
126 | - var j=0; //얘는 반복문용 | 111 | + tooltip: { |
127 | - for(;j<10-length;j++) | 112 | + headerFormat: "<b>{series.name}</b><br/>", |
128 | - { | 113 | + pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" |
129 | - deathArr.push({ | 114 | + }, |
130 | - x: time + i * 60000, | 115 | + legend: { |
131 | - y: 0 | 116 | + //enabled: false |
132 | - }) | 117 | + layout: "vertical", |
118 | + align: "left", | ||
119 | + verticalAlign: "top", | ||
120 | + x: 120, | ||
121 | + y: 70, | ||
122 | + floating: true, | ||
123 | + borderWidth: 1, | ||
124 | + backgroundColor: | ||
125 | + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
126 | + "#FFFFFF" | ||
127 | + }, | ||
128 | + exporting: { | ||
129 | + enabled: false | ||
130 | + }, | ||
131 | + series: [ | ||
132 | + { | ||
133 | + name: "사망률", | ||
134 | + data: (function () { | ||
135 | + var deathArr = [], | ||
136 | + time = new Date().getTime(); | ||
137 | + var length = <%=dataLen%>; | ||
138 | + var i = -9; //얘는 시간계산용 | ||
139 | + var j = 0; //얘는 반복문용 | ||
140 | + for (; j < 10 - length; j++) { | ||
141 | + deathArr.push({ | ||
142 | + x: time + i * 60000, | ||
143 | + y: 0 | ||
144 | + }) | ||
133 | i++; | 145 | i++; |
134 | - } | 146 | + } |
135 | 147 | ||
136 | - <%probArr.forEach((probArr)=>{%> | 148 | + <% probArr.forEach((probArr) => {%> |
137 | var temp; | 149 | var temp; |
138 | - temp= <%=probArr%>; | 150 | + temp = <%=probArr %>; |
139 | - | 151 | + |
140 | - // for(;j<10;j++) | 152 | + // for(;j<10;j++) |
141 | - // { | 153 | + // { |
142 | - // deathArr.push({ | 154 | + // deathArr.push({ |
143 | - // x: time + i * 60000, | 155 | + // x: time + i * 60000, |
144 | - // y: temp | 156 | + // y: temp |
145 | - // }) | 157 | + // }) |
146 | - // i++; | 158 | + // i++; |
147 | - // } | 159 | + // } |
148 | - | 160 | + |
149 | - deathArr.push({ | 161 | + deathArr.push({ |
150 | x: time + i * 60000, | 162 | x: time + i * 60000, |
151 | y: temp | 163 | y: temp |
152 | - }) | 164 | + }) |
153 | - i++; | 165 | + i++; |
154 | 166 | ||
155 | - <%})%> | 167 | + <%}) %> |
156 | 168 | ||
157 | return deathArr; | 169 | return deathArr; |
158 | - })() | 170 | + })() |
159 | - } | 171 | + } |
160 | - ] | 172 | + ] |
161 | - }); | 173 | + }); |
162 | - </script> | 174 | + //기온 |
163 | - | 175 | + var chart2 = Highcharts.chart("container2", { |
164 | - <!-- 두번째 그래프 --> | 176 | + chart: { |
165 | - <script type="text/javascript"> | 177 | + type: "spline", |
166 | - Highcharts.chart("container2", { | 178 | + animation: Highcharts.svg, // don't animate in old IE |
167 | - chart: { | 179 | + marginRight: 10, |
168 | - type: "spline", | 180 | + // events: { |
169 | - animation: Highcharts.svg, // don't animate in old IE | 181 | + // load: function () { |
170 | - marginRight: 10, | 182 | + // // set up the updating of the chart each second |
171 | - events: { | 183 | + // var series = this.series[0]; |
172 | - load: function() { | 184 | + // setInterval(function () { |
173 | - // set up the updating of the chart each second | 185 | + // var x = new Date().getTime(), // 현재 시간 |
174 | - var series = this.series[0]; | 186 | + // y = 0; // |
175 | - setInterval(function() { | 187 | + // series.addPoint([x, y], true, true); |
176 | - var x = new Date().getTime(), // 현재 시간 | 188 | + // }, 60000); //1000=1초 |
177 | - y = 0; // | 189 | + // } |
178 | - series.addPoint([x, y], true, true); | 190 | + // } |
179 | - }, 60000); //1000=1초 | 191 | + }, |
180 | - } | ||
181 | - } | ||
182 | - }, | ||
183 | 192 | ||
184 | - time: { | 193 | + time: { |
185 | - useUTC: false | 194 | + useUTC: false |
186 | - }, | 195 | + }, |
187 | 196 | ||
197 | + title: { | ||
198 | + text: "기온" | ||
199 | + }, | ||
200 | + xAxis: { | ||
201 | + type: "datetime", | ||
202 | + tickPixelInterval: 150 | ||
203 | + }, | ||
204 | + yAxis: { | ||
188 | title: { | 205 | title: { |
189 | - text: "기온" | 206 | + text: "Value" |
190 | - }, | ||
191 | - xAxis: { | ||
192 | - type: "datetime", | ||
193 | - tickPixelInterval: 150 | ||
194 | - }, | ||
195 | - yAxis: { | ||
196 | - title: { | ||
197 | - text: "Value" | ||
198 | - }, | ||
199 | - plotLines: [ | ||
200 | - { | ||
201 | - value: 0, | ||
202 | - width: 1, | ||
203 | - color: "#808080" | ||
204 | - } | ||
205 | - ] | ||
206 | - }, | ||
207 | - tooltip: { | ||
208 | - headerFormat: "<b>{series.name}</b><br/>", | ||
209 | - pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" | ||
210 | - }, | ||
211 | - legend: { | ||
212 | - //enabled: false | ||
213 | - layout: "vertical", | ||
214 | - align: "left", | ||
215 | - verticalAlign: "top", | ||
216 | - x: 120, | ||
217 | - y: 70, | ||
218 | - floating: true, | ||
219 | - borderWidth: 1, | ||
220 | - backgroundColor: | ||
221 | - (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
222 | - "#FFFFFF" | ||
223 | }, | 207 | }, |
224 | - exporting: { | 208 | + plotLines: [ |
225 | - enabled: false | ||
226 | - }, | ||
227 | - series: [ | ||
228 | { | 209 | { |
229 | - name: "기온", | 210 | + value: 0, |
230 | - data: (function() { | 211 | + width: 1, |
231 | - var tempArr = [], | 212 | + color: "#808080" |
232 | - time = new Date().getTime(); | 213 | + } |
233 | - var length= <%=dataLen%>; | 214 | + ] |
234 | - var i=-9; | 215 | + }, |
235 | - var j=0; | 216 | + tooltip: { |
236 | - for(j;j<10-length;j++) | 217 | + headerFormat: "<b>{series.name}</b><br/>", |
237 | - { | 218 | + pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" |
238 | - tempArr.push({ | 219 | + }, |
239 | - x: time + i * 60000, | 220 | + legend: { |
240 | - y: 0 | 221 | + //enabled: false |
241 | - }) | 222 | + layout: "vertical", |
223 | + align: "left", | ||
224 | + verticalAlign: "top", | ||
225 | + x: 120, | ||
226 | + y: 70, | ||
227 | + floating: true, | ||
228 | + borderWidth: 1, | ||
229 | + backgroundColor: | ||
230 | + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
231 | + "#FFFFFF" | ||
232 | + }, | ||
233 | + exporting: { | ||
234 | + enabled: false | ||
235 | + }, | ||
236 | + series: [ | ||
237 | + { | ||
238 | + name: "기온", | ||
239 | + data: (function () { | ||
240 | + var tempArr = [], | ||
241 | + time = new Date().getTime(); | ||
242 | + var length = <%=dataLen%>; | ||
243 | + var i = -9; | ||
244 | + var j = 0; | ||
245 | + for (j; j < 10 - length; j++) { | ||
246 | + tempArr.push({ | ||
247 | + x: time + i * 60000, | ||
248 | + y: 0 | ||
249 | + }) | ||
242 | i++; | 250 | i++; |
243 | - } | 251 | + } |
244 | 252 | ||
245 | - <%ptArr.forEach((ptArr)=>{%> | 253 | + <% ptArr.forEach((ptArr) => {%> |
246 | var temp; | 254 | var temp; |
247 | - temp= <%=ptArr%>; | 255 | + temp = <%=ptArr %>; |
248 | - | 256 | + |
249 | - // for(j;j<10;j++) | 257 | + // for(j;j<10;j++) |
250 | - // { | 258 | + // { |
251 | - // tempArr.push({ | 259 | + // tempArr.push({ |
252 | - // x: time + i * 60000, | 260 | + // x: time + i * 60000, |
253 | - // y: temp | 261 | + // y: temp |
254 | - // }) | 262 | + // }) |
255 | - // i++; | 263 | + // i++; |
256 | - // } | 264 | + // } |
257 | - | 265 | + |
258 | - tempArr.push({ | 266 | + tempArr.push({ |
259 | x: time + i * 60000, | 267 | x: time + i * 60000, |
260 | y: temp | 268 | y: temp |
261 | - }) | 269 | + }) |
262 | - i++; | 270 | + i++; |
263 | 271 | ||
264 | - <%})%> | 272 | + <%}) %> |
265 | 273 | ||
266 | return tempArr; | 274 | return tempArr; |
267 | - })() | 275 | + })() |
268 | - } | 276 | + } |
269 | - ] | 277 | + ] |
270 | - }); | 278 | + }); |
271 | - </script> | 279 | + //풍속 |
272 | - | 280 | + var chart3 = Highcharts.chart("container3", { |
273 | - <!-- 세번째 그래프 --> | 281 | + chart: { |
274 | - <script type="text/javascript"> | 282 | + type: "spline", |
275 | - Highcharts.chart("container3", { | 283 | + animation: Highcharts.svg, // don't animate in old IE |
276 | - chart: { | 284 | + marginRight: 10, |
277 | - type: "spline", | 285 | + // events: { |
278 | - animation: Highcharts.svg, // don't animate in old IE | 286 | + // load: function () { |
279 | - marginRight: 10, | 287 | + // // set up the updating of the chart each second |
280 | - events: { | 288 | + // var series = this.series[0]; |
281 | - load: function() { | 289 | + // setInterval(function () { |
282 | - // set up the updating of the chart each second | 290 | + // var x = new Date().getTime(), // 현재 시간 |
283 | - var series = this.series[0]; | 291 | + // y = 0; // |
284 | - setInterval(function() { | 292 | + // series.addPoint([x, y], true, true); |
285 | - var x = new Date().getTime(), // 현재 시간 | 293 | + // }, 60000); //1000=1초 |
286 | - y = 0; // | 294 | + // } |
287 | - series.addPoint([x, y], true, true); | 295 | + // } |
288 | - }, 60000); //1000=1초 | 296 | + }, |
289 | - } | ||
290 | - } | ||
291 | - }, | ||
292 | 297 | ||
293 | - time: { | 298 | + time: { |
294 | - useUTC: false | 299 | + useUTC: false |
295 | - }, | 300 | + }, |
296 | 301 | ||
302 | + title: { | ||
303 | + text: "풍속" | ||
304 | + }, | ||
305 | + xAxis: { | ||
306 | + type: "datetime", | ||
307 | + tickPixelInterval: 150 | ||
308 | + }, | ||
309 | + yAxis: { | ||
297 | title: { | 310 | title: { |
298 | - text: "풍속" | 311 | + text: "Value" |
299 | - }, | ||
300 | - xAxis: { | ||
301 | - type: "datetime", | ||
302 | - tickPixelInterval: 150 | ||
303 | - }, | ||
304 | - yAxis: { | ||
305 | - title: { | ||
306 | - text: "Value" | ||
307 | - }, | ||
308 | - plotLines: [ | ||
309 | - { | ||
310 | - value: 0, | ||
311 | - width: 1, | ||
312 | - color: "#808080" | ||
313 | - } | ||
314 | - ] | ||
315 | - }, | ||
316 | - tooltip: { | ||
317 | - headerFormat: "<b>{series.name}</b><br/>", | ||
318 | - pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" | ||
319 | }, | 312 | }, |
320 | - legend: { | 313 | + plotLines: [ |
321 | - //enabled: false | ||
322 | - layout: "vertical", | ||
323 | - align: "left", | ||
324 | - verticalAlign: "top", | ||
325 | - x: 120, | ||
326 | - y: 70, | ||
327 | - floating: true, | ||
328 | - borderWidth: 1, | ||
329 | - backgroundColor: | ||
330 | - (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
331 | - "#FFFFFF" | ||
332 | - }, | ||
333 | - exporting: { | ||
334 | - enabled: false | ||
335 | - }, | ||
336 | - series: [ | ||
337 | { | 314 | { |
338 | - name: "풍속", | 315 | + value: 0, |
339 | - data: (function() { | 316 | + width: 1, |
340 | - var windArr = [], | 317 | + color: "#808080" |
341 | - time = new Date().getTime(); | 318 | + } |
342 | - var length= <%=dataLen%>; | 319 | + ] |
343 | - var i=-9; | 320 | + }, |
344 | - var j=0; | 321 | + tooltip: { |
345 | - for(j;j<10-length;j++) | 322 | + headerFormat: "<b>{series.name}</b><br/>", |
346 | - { | 323 | + pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" |
347 | - windArr.push({ | 324 | + }, |
348 | - x: time + i * 60000, | 325 | + legend: { |
349 | - y: 0 | 326 | + //enabled: false |
350 | - }) | 327 | + layout: "vertical", |
328 | + align: "left", | ||
329 | + verticalAlign: "top", | ||
330 | + x: 120, | ||
331 | + y: 70, | ||
332 | + floating: true, | ||
333 | + borderWidth: 1, | ||
334 | + backgroundColor: | ||
335 | + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
336 | + "#FFFFFF" | ||
337 | + }, | ||
338 | + exporting: { | ||
339 | + enabled: false | ||
340 | + }, | ||
341 | + series: [ | ||
342 | + { | ||
343 | + name: "풍속", | ||
344 | + data: (function () { | ||
345 | + var windArr = [], | ||
346 | + time = new Date().getTime(); | ||
347 | + var length = <%=dataLen%>; | ||
348 | + var i = -9; | ||
349 | + var j = 0; | ||
350 | + for (j; j < 10 - length; j++) { | ||
351 | + windArr.push({ | ||
352 | + x: time + i * 60000, | ||
353 | + y: 0 | ||
354 | + }) | ||
351 | i++; | 355 | i++; |
352 | - } | 356 | + } |
353 | 357 | ||
354 | - <%wsArr.forEach((wsArr)=>{%> | 358 | + <% wsArr.forEach((wsArr) => {%> |
355 | var temp; | 359 | var temp; |
356 | - temp= <%=wsArr%>; | 360 | + temp = <%=wsArr %>; |
357 | - | 361 | + |
358 | - // for(j;j<10;j++) | 362 | + // for(j;j<10;j++) |
359 | - // { | 363 | + // { |
360 | - // windArr.push({ | 364 | + // windArr.push({ |
361 | - // x: time + i * 60000, | 365 | + // x: time + i * 60000, |
362 | - // y: temp | 366 | + // y: temp |
363 | - // }) | 367 | + // }) |
364 | - // i++; | 368 | + // i++; |
365 | - // } | 369 | + // } |
366 | - | 370 | + |
367 | - windArr.push({ | 371 | + windArr.push({ |
368 | x: time + i * 60000, | 372 | x: time + i * 60000, |
369 | y: temp | 373 | y: temp |
370 | - }) | 374 | + }) |
371 | - i++; | 375 | + i++; |
372 | 376 | ||
373 | - <%})%> | 377 | + <%}) %> |
374 | 378 | ||
375 | return windArr; | 379 | return windArr; |
376 | - })() | 380 | + })() |
377 | - } | 381 | + } |
378 | - ] | 382 | + ] |
379 | - }); | 383 | + }); |
380 | - </script> | 384 | + //강수량 |
381 | - | 385 | + var chart4 = Highcharts.chart("container4", { |
382 | - <!-- 네번째 그래프 --> | 386 | + chart: { |
383 | - <script type="text/javascript"> | 387 | + type: "spline", |
384 | - Highcharts.chart("container4", { | 388 | + animation: Highcharts.svg, // don't animate in old IE |
385 | - chart: { | 389 | + marginRight: 10, |
386 | - type: "spline", | 390 | + // events: { |
387 | - animation: Highcharts.svg, // don't animate in old IE | 391 | + // load: function () { |
388 | - marginRight: 10, | 392 | + // // set up the updating of the chart each second |
389 | - events: { | 393 | + // var series = this.series[0]; |
390 | - load: function() { | 394 | + // setInterval(function () { |
391 | - // set up the updating of the chart each second | 395 | + // var x = new Date().getTime(), // 현재 시간 |
392 | - var series = this.series[0]; | 396 | + // y = 0; // |
393 | - setInterval(function() { | 397 | + // series.addPoint([x, y], true, true); |
394 | - var x = new Date().getTime(), // 현재 시간 | 398 | + // }, 60000); //1000=1초 |
395 | - y = 0; // | 399 | + // } |
396 | - series.addPoint([x, y], true, true); | 400 | + // } |
397 | - }, 60000); //1000=1초 | 401 | + }, |
398 | - } | ||
399 | - } | ||
400 | - }, | ||
401 | 402 | ||
402 | - time: { | 403 | + time: { |
403 | - useUTC: false | 404 | + useUTC: false |
404 | - }, | 405 | + }, |
405 | 406 | ||
407 | + title: { | ||
408 | + text: "강수량" | ||
409 | + }, | ||
410 | + xAxis: { | ||
411 | + type: "datetime", | ||
412 | + tickPixelInterval: 150 | ||
413 | + }, | ||
414 | + yAxis: { | ||
406 | title: { | 415 | title: { |
407 | - text: "강수량" | 416 | + text: "Value" |
408 | - }, | ||
409 | - xAxis: { | ||
410 | - type: "datetime", | ||
411 | - tickPixelInterval: 150 | ||
412 | - }, | ||
413 | - yAxis: { | ||
414 | - title: { | ||
415 | - text: "Value" | ||
416 | - }, | ||
417 | - plotLines: [ | ||
418 | - { | ||
419 | - value: 0, | ||
420 | - width: 1, | ||
421 | - color: "#808080" | ||
422 | - } | ||
423 | - ] | ||
424 | }, | 417 | }, |
425 | - tooltip: { | 418 | + plotLines: [ |
426 | - headerFormat: "<b>{series.name}</b><br/>", | ||
427 | - pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" | ||
428 | - }, | ||
429 | - legend: { | ||
430 | - //enabled: false | ||
431 | - layout: "vertical", | ||
432 | - align: "left", | ||
433 | - verticalAlign: "top", | ||
434 | - x: 120, | ||
435 | - y: 70, | ||
436 | - floating: true, | ||
437 | - borderWidth: 1, | ||
438 | - backgroundColor: | ||
439 | - (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
440 | - "#FFFFFF" | ||
441 | - }, | ||
442 | - exporting: { | ||
443 | - enabled: false | ||
444 | - }, | ||
445 | - series: [ | ||
446 | { | 419 | { |
447 | - name: "강수량", | 420 | + value: 0, |
448 | - data: (function() { | 421 | + width: 1, |
449 | - var rainArr = [], | 422 | + color: "#808080" |
450 | - time = new Date().getTime(); | 423 | + } |
451 | - var length= <%=dataLen%>; | 424 | + ] |
452 | - var i=-9; | 425 | + }, |
453 | - var j=0; | 426 | + tooltip: { |
454 | - for(j;j<10-length;j++) | 427 | + headerFormat: "<b>{series.name}</b><br/>", |
455 | - { | 428 | + pointFormat: "{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}" |
456 | - rainArr.push({ | 429 | + }, |
457 | - x: time + i * 60000, | 430 | + legend: { |
458 | - y: 0 | 431 | + //enabled: false |
459 | - }) | 432 | + layout: "vertical", |
433 | + align: "left", | ||
434 | + verticalAlign: "top", | ||
435 | + x: 120, | ||
436 | + y: 70, | ||
437 | + floating: true, | ||
438 | + borderWidth: 1, | ||
439 | + backgroundColor: | ||
440 | + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || | ||
441 | + "#FFFFFF" | ||
442 | + }, | ||
443 | + exporting: { | ||
444 | + enabled: false | ||
445 | + }, | ||
446 | + series: [ | ||
447 | + { | ||
448 | + name: "강수량", | ||
449 | + data: (function () { | ||
450 | + var rainArr = [], | ||
451 | + time = new Date().getTime(); | ||
452 | + var length = <%=dataLen%>; | ||
453 | + var i = -9; | ||
454 | + var j = 0; | ||
455 | + for (j; j < 10 - length; j++) { | ||
456 | + rainArr.push({ | ||
457 | + x: time + i * 60000, | ||
458 | + y: 0 | ||
459 | + }) | ||
460 | i++; | 460 | i++; |
461 | - } | 461 | + } |
462 | 462 | ||
463 | - <%rainArr.forEach((rainArr)=>{%> | 463 | + <% rainArr.forEach((rainArr) => {%> |
464 | var temp; | 464 | var temp; |
465 | - temp= <%=rainArr%>; | 465 | + temp = <%=rainArr %>; |
466 | - | 466 | + |
467 | - // for(j;j<10;j++) | 467 | + // for(j;j<10;j++) |
468 | - // { | 468 | + // { |
469 | - // rainArr.push({ | 469 | + // rainArr.push({ |
470 | - // x: time + i * 60000, | 470 | + // x: time + i * 60000, |
471 | - // y: temp | 471 | + // y: temp |
472 | - // }) | 472 | + // }) |
473 | - // i++; | 473 | + // i++; |
474 | - // } | 474 | + // } |
475 | - | 475 | + |
476 | - rainArr.push({ | 476 | + rainArr.push({ |
477 | x: time + i * 60000, | 477 | x: time + i * 60000, |
478 | y: temp | 478 | y: temp |
479 | - }) | 479 | + }) |
480 | - i++; | 480 | + i++; |
481 | 481 | ||
482 | - <%})%> | 482 | + <%}) %> |
483 | 483 | ||
484 | return rainArr; | 484 | return rainArr; |
485 | - })() | 485 | + })() |
486 | - } | 486 | + } |
487 | - ] | 487 | + ] |
488 | - }); | 488 | + }); |
489 | - </script> | 489 | + </script> |
490 | - </body> | 490 | +</body> |
491 | -</html> | 491 | + |
492 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment