김윤지

Merge branch 'master' into 'master'

데이터 전송 안되는것 수정, 그래프 추가

데이터 전송 안되는것 수정, 그래프 추가

See merge request !8
...@@ -39,6 +39,7 @@ build/Release ...@@ -39,6 +39,7 @@ build/Release
39 # Dependency directories 39 # Dependency directories
40 node_modules/ 40 node_modules/
41 jspm_packages/ 41 jspm_packages/
42 +keys/
42 # TypeScript v1 declaration files 43 # TypeScript v1 declaration files
43 typings/ 44 typings/
44 45
......
1 -module.exports = {
2 - key: "aaaa"
3 -}
4 -//개인 Server Key 받아서 사용해야함, Browser key 안됨
...\ No newline at end of file ...\ No newline at end of file
1 -module.exports = {
2 - key: "aaaa"
3 -}
1 -module.exports = {
2 - host: 'localhost',
3 - user: 'root',
4 - password: 'Serrmica0!',
5 - database: 'db_option_total'
6 -}
...\ No newline at end of file ...\ No newline at end of file
...@@ -4,8 +4,8 @@ const secret_key_traffic = require('../keys/api_option_traffic').key; ...@@ -4,8 +4,8 @@ const secret_key_traffic = require('../keys/api_option_traffic').key;
4 4
5 const requesting = require('request'); 5 const requesting = require('request');
6 6
7 -const lat = "37.54922931758";//"37.239795"; //weather 위도 7 +const lat = "37.54922931758"; //weather 위도
8 -const lon = "126.913415969472";//"127.083240"; //weather 경도 8 +const lon = "126.913415969472"; //weather 경도
9 const sido_num = "11"; //traffic 법정동 시도 코드 9 const sido_num = "11"; //traffic 법정동 시도 코드
10 const gugun_num = "440"; //traffic 법정동 시군구 코드 - 합정동 일대 10 const gugun_num = "440"; //traffic 법정동 시군구 코드 - 합정동 일대
11 const search_year = "2018074"; //traffic 검색을 원하는 연도 11 const search_year = "2018074"; //traffic 검색을 원하는 연도
...@@ -42,17 +42,18 @@ module.exports = (server, app) => { ...@@ -42,17 +42,18 @@ module.exports = (server, app) => {
42 json: true 42 json: true
43 }, 43 },
44 //api에게 응답 받았을때 실행되는 callback function 44 //api에게 응답 받았을때 실행되는 callback function
45 - function (err, api_res, api_body) { 45 + function (err1, api_res1, api_body1) {
46 //err 존재시 promise reject 호출 46 //err 존재시 promise reject 호출
47 - if (err) reject(err); 47 + if (err1) reject(err1);
48 48
49 // api의 response이 있을경우 promise resolve 호출 49 // api의 response이 있을경우 promise resolve 호출
50 - if (api_res) { 50 + if (api_res1) {
51 console.log("calling weather api"); 51 console.log("calling weather api");
52 - resolve(api_body); 52 + resolve(api_body1);
53 } 53 }
54 }); 54 });
55 - }) 55 +
56 + }) //Promise
56 } 57 }
57 58
58 59
...@@ -63,12 +64,6 @@ module.exports = (server, app) => { ...@@ -63,12 +64,6 @@ module.exports = (server, app) => {
63 requesting.get({ 64 requesting.get({
64 // api를 요청할 주소 -- 시크릿키,위도,경도 입력 65 // api를 요청할 주소 -- 시크릿키,위도,경도 입력
65 url: `http://apis.data.go.kr/B552061/${cate1}/${cate2}?ServiceKey=${secret_key_traffic}&searchYearCd=${search_year}&siDo=${sido_num}&guGun=${gugun_num}&type=json&numOfRows=1&pageNo=1`, 66 url: `http://apis.data.go.kr/B552061/${cate1}/${cate2}?ServiceKey=${secret_key_traffic}&searchYearCd=${search_year}&siDo=${sido_num}&guGun=${gugun_num}&type=json&numOfRows=1&pageNo=1`,
66 - //나중에 삭제 http://apis.data.go.kr/B552061/frequentzoneLg/getRestFrequentzoneLg?ServiceKey=XOLqI9tY4gVCdk1i2BoOM3EYmSUYqt8WlXUfIDSfD4RnNBrFwwthbNAtGOxoskP540JbUAzcnuABsydoE2U2dA%3D%3D&searchYearCd=2017&siDo=11&guGun=200&type=json&numOfRows=10&pageNo=1
67 - //나중에 삭제 http://apis.data.go.kr/B552061/frequentzoneLg/getRestFrequentzoneLg?ServiceKey=XOLqI9tY4gVCdk1i2BoOM3EYmSUYqt8WlXUfIDSfD4RnNBrFwwthbNAtGOxoskP540JbUAzcnuABsydoE2U2dA%3D%3D&searchYearCd=2018074&siDo=11&guGun=440&type=json&numOfRows=10&pageNo=1
68 - //sido = 11 gugun = 440 (마포구 합정동, 도화동, 도화동)
69 - //cate1 = frequentzoneLg
70 - //cate2 = getRestFrequentzoneLg
71 - //xml: true
72 json: true 67 json: true
73 }, 68 },
74 //api에게 응답 받았을때 실행되는 callback function 69 //api에게 응답 받았을때 실행되는 callback function
...@@ -82,20 +77,26 @@ module.exports = (server, app) => { ...@@ -82,20 +77,26 @@ module.exports = (server, app) => {
82 resolve(api_body); 77 resolve(api_body);
83 } 78 }
84 }); 79 });
85 - }) 80 + }) //Promise
86 } 81 }
87 82
88 const API_bundle = async () => { 83 const API_bundle = async () => {
89 -
90 try { 84 try {
85 + var order = 0;
86 + while (order < 2) {
87 + switch (order) {
88 + case 0:
89 + console.log("APIWait - WAITING FOR ALL API");
91 Current_Weather = await req_API("current", "minutely"); //현재날씨 (분별) //when, what 90 Current_Weather = await req_API("current", "minutely"); //현재날씨 (분별) //when, what
92 Sensible_T = await req_API("index", "wct"); //체감온도 91 Sensible_T = await req_API("index", "wct"); //체감온도
93 Heat_index = await req_API("index", "heat"); //열지수 92 Heat_index = await req_API("index", "heat"); //열지수
94 Discomport_index = await req_API("index", "th"); //불쾌지수 93 Discomport_index = await req_API("index", "th"); //불쾌지수
95 Ultra_Violet_index = await req_API("index", "uv"); //자외선지수 94 Ultra_Violet_index = await req_API("index", "uv"); //자외선지수
96 -
97 Current_TrafficAcc = await req_API_traffic("frequentzoneLg", "getRestFrequentzoneLg"); //cate1, cate2 95 Current_TrafficAcc = await req_API_traffic("frequentzoneLg", "getRestFrequentzoneLg"); //cate1, cate2
98 - 96 + order = 1;
97 + break;
98 + case 1:
99 + console.log("APIDataProcess - CALLING INFO");
99 info = { 100 info = {
100 heat: Heat_index.weather.wIndex.heatIndex[0].current.index, //열지수 101 heat: Heat_index.weather.wIndex.heatIndex[0].current.index, //열지수
101 sensible_temperature: Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도 102 sensible_temperature: Sensible_T.weather.wIndex.wctIndex[0].current.index, //체감온도
...@@ -180,6 +181,13 @@ module.exports = (server, app) => { ...@@ -180,6 +181,13 @@ module.exports = (server, app) => {
180 db_total.query(sql, [client_send.time, client_send.wind, client_send.temperature, client_send.rain, client_send.death, client_send.trafficdeath, client_send.mhurt, client_send.lhurt, client_send.occurence], (err, result) => { 181 db_total.query(sql, [client_send.time, client_send.wind, client_send.temperature, client_send.rain, client_send.death, client_send.trafficdeath, client_send.mhurt, client_send.lhurt, client_send.occurence], (err, result) => {
181 if (err) console.log(err); 182 if (err) console.log(err);
182 }) 183 })
184 + order = 2;
185 + break;
186 + default:
187 + order = 3;
188 + break;
189 + }//switch
190 + }; //while
183 191
184 } catch (err) { //promise err or try err catch 192 } catch (err) { //promise err or try err catch
185 console.log("================Error Occured !!================\n", err); 193 console.log("================Error Occured !!================\n", err);
......
...@@ -4,7 +4,7 @@ var db = require('../lib/db_total'); ...@@ -4,7 +4,7 @@ var db = require('../lib/db_total');
4 4
5 /* GET home page. */ 5 /* GET home page. */
6 6
7 -router.post('/starting' , (req,res) => { 7 +router.post('/starting', (req, res) => {
8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}`); 8 res.redirect(`/name/${req.body.name}/birth/${req.body.birth}`);
9 }) 9 })
10 router.get('/name/:name/birth/:birth', (req, res) => { 10 router.get('/name/:name/birth/:birth', (req, res) => {
...@@ -23,10 +23,10 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -23,10 +23,10 @@ router.get('/name/:name/birth/:birth', (req, res) => {
23 const birth = req.params.birth; 23 const birth = req.params.birth;
24 //const address = req.params.address; 24 //const address = req.params.address;
25 //////////////////////////////////////// 25 ////////////////////////////////////////
26 - var deathArr = new Array(); 26 + var tdeathArr = new Array(); //사망자수
27 - var mhurtArr = new Array(); 27 + var mhurtArr = new Array(); //중상자수
28 - var lhurtArr = new Array(); 28 + var lhurtArr = new Array(); //경상자수
29 - var occurArr = new Array(); 29 + var occurArr = new Array(); //총 발생수
30 //////////////////////////////////////// 30 ////////////////////////////////////////
31 31
32 32
...@@ -48,7 +48,7 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -48,7 +48,7 @@ router.get('/name/:name/birth/:birth', (req, res) => {
48 wsArr.unshift(rows[i].wind); 48 wsArr.unshift(rows[i].wind);
49 rainArr.unshift(rows[i].rain); 49 rainArr.unshift(rows[i].rain);
50 //// 50 ////
51 - deathArr.unshift(rows[i].tdeath); 51 + tdeathArr.unshift(rows[i].tdeath);
52 mhurtArr.unshift(rows[i].mhurt); 52 mhurtArr.unshift(rows[i].mhurt);
53 lhurtArr.unshift(rows[i].lhurt); 53 lhurtArr.unshift(rows[i].lhurt);
54 occurArr.unshift(rows[i].occurence); 54 occurArr.unshift(rows[i].occurence);
...@@ -71,7 +71,7 @@ router.get('/name/:name/birth/:birth', (req, res) => { ...@@ -71,7 +71,7 @@ router.get('/name/:name/birth/:birth', (req, res) => {
71 dataLen, 71 dataLen,
72 name, 72 name,
73 birth, 73 birth,
74 - deathArr, 74 + tdeathArr,
75 mhurtArr, 75 mhurtArr,
76 lhurtArr, 76 lhurtArr,
77 occurArr 77 occurArr
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
3 <head> 3 <head>
4 <!-- font --> 4 <!-- font -->
5 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet" /> 5 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet" />
6 - <link href="https://fonts.googleapis.com/css?family=Yeon+Sung&amp;subset=korean" rel="stylesheet" /> 6 + <link href="https://fonts.googleapis.com/css?family=Do+Hyeon&display=swap" rel="stylesheet">
7 -
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1" /> 8 <meta name="viewport" content="width=device-width, initial-scale=1" />
10 <title>Highcharts Example</title> 9 <title>Highcharts Example</title>
11 -
12 <style type="text/css"> 10 <style type="text/css">
13 html { 11 html {
14 margin: 0; 12 margin: 0;
...@@ -17,10 +15,9 @@ ...@@ -17,10 +15,9 @@
17 body { 15 body {
18 margin: 0; 16 margin: 0;
19 padding: 0; 17 padding: 0;
20 -
21 /* background: linear-gradient( to bottom, #65799B, rgb(38, 14, 41) ); */ 18 /* background: linear-gradient( to bottom, #65799B, rgb(38, 14, 41) ); */
22 /* background-color:#65799B; */ 19 /* background-color:#65799B; */
23 - /* background-image: url("2.jpg"); 20 + /* background-image: url("2.jpg"); */
24 background-repeat: no-repeat; 21 background-repeat: no-repeat;
25 background-size: cover; */ 22 background-size: cover; */
26 } 23 }
...@@ -29,20 +26,15 @@ ...@@ -29,20 +26,15 @@
29 top: 0; 26 top: 0;
30 width: 100%; 27 width: 100%;
31 } 28 }
32 -
33 </style> 29 </style>
34 </head> 30 </head>
35 -
36 <body> 31 <body>
37 <script src="highcharts.js"></script> 32 <script src="highcharts.js"></script>
38 <script src="modules/exporting.js"></script> 33 <script src="modules/exporting.js"></script>
39 <script src="modules/export-data.js"></script> 34 <script src="modules/export-data.js"></script>
40 -
41 <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> 35 <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
42 -
43 <div id="banner"> 36 <div id="banner">
44 <div id="container1" style="width:1260px; height: 400px; margin: 0 auto;"></div> 37 <div id="container1" style="width:1260px; height: 400px; margin: 0 auto;"></div>
45 -
46 <div style="width:1275px; margin:0 auto;"> 38 <div style="width:1275px; margin:0 auto;">
47 <div style="display: inline-block;"> 39 <div style="display: inline-block;">
48 <div id="container2" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> 40 <div id="container2" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div>
...@@ -50,12 +42,13 @@ ...@@ -50,12 +42,13 @@
50 <div style="display: inline-block;"> 42 <div style="display: inline-block;">
51 <div id="container3" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div> 43 <div id="container3" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div>
52 </div> 44 </div>
53 -
54 <div style="display: inline-block;"> 45 <div style="display: inline-block;">
55 <div id="container4" style="width:400px; height: 300px; padding:0; margin-left:0px;"></div> 46 <div id="container4" style="width:400px; height: 300px; padding:0; margin-left:0px;"></div>
56 </div> 47 </div>
48 + <div style="display: inline-block;">
49 + <div id="container5" style="width:400px; height: 300px; padding:0; margin-left:0px;margin-right: 30px;"></div>
50 + </div>
57 </div> 51 </div>
58 -
59 <script src="/socket.io/socket.io.js"></script> 52 <script src="/socket.io/socket.io.js"></script>
60 <script type="text/javascript"> 53 <script type="text/javascript">
61 let client_data = { 54 let client_data = {
...@@ -63,7 +56,6 @@ ...@@ -63,7 +56,6 @@
63 name: "<%=name%>" 56 name: "<%=name%>"
64 } 57 }
65 58
66 -
67 var chart1 = Highcharts.chart("container1", { 59 var chart1 = Highcharts.chart("container1", {
68 chart: { 60 chart: {
69 type: "spline", 61 type: "spline",
...@@ -75,25 +67,22 @@ ...@@ -75,25 +67,22 @@
75 // var series = this.series[0]; 67 // var series = this.series[0];
76 // setInterval(function () { 68 // setInterval(function () {
77 // var x = new Date().getTime(), // 현재 시간 69 // var x = new Date().getTime(), // 현재 시간
78 - // y = Math.random(); //여기에 새로 넣을 값 70 + // y = Math.random(); //여기에 새로 넣을 값(실시간 사망률)
79 // series.addPoint({x:x,y:y,color:"#FFE08C"}, true, true); 71 // series.addPoint({x:x,y:y,color:"#FFE08C"}, true, true);
80 // }, 1000); //1000=1초 -> 1분=60000 72 // }, 1000); //1000=1초 -> 1분=60000
81 // } 73 // }
82 // }, 74 // },
83 -
84 backgroundColor: "rgba(255, 255, 255, 0.0)" 75 backgroundColor: "rgba(255, 255, 255, 0.0)"
85 }, 76 },
86 -
87 time: { 77 time: {
88 useUTC: false 78 useUTC: false
89 }, 79 },
90 -
91 title: { 80 title: {
92 text: "<%=name%>님의 실시간 사망 확률", 81 text: "<%=name%>님의 실시간 사망 확률",
93 style: { 82 style: {
94 color: "#FFFFFF", 83 color: "#FFFFFF",
95 - fontWeight: "bold", 84 + //fontWeight: "bold",
96 - fontFamily: 'Yeon Sung', 85 + fontFamily: 'Do Hyeon',
97 fontSize:'32px' 86 fontSize:'32px'
98 } 87 }
99 }, 88 },
...@@ -113,7 +102,6 @@ ...@@ -113,7 +102,6 @@
113 color: "white" 102 color: "white"
114 } 103 }
115 }, 104 },
116 -
117 plotLines: [ 105 plotLines: [
118 { 106 {
119 value: 0, 107 value: 0,
...@@ -126,7 +114,6 @@ ...@@ -126,7 +114,6 @@
126 color: "white" 114 color: "white"
127 } 115 }
128 } 116 }
129 -
130 }, 117 },
131 tooltip: { 118 tooltip: {
132 headerFormat: "<b>{series.name}</b><br/>", 119 headerFormat: "<b>{series.name}</b><br/>",
...@@ -148,7 +135,6 @@ ...@@ -148,7 +135,6 @@
148 exporting: { 135 exporting: {
149 enabled: false 136 enabled: false
150 }, 137 },
151 -
152 plotOptions: { 138 plotOptions: {
153 series: { 139 series: {
154 marker: { 140 marker: {
...@@ -156,7 +142,6 @@ plotOptions: { ...@@ -156,7 +142,6 @@ plotOptions: {
156 } 142 }
157 } 143 }
158 }, 144 },
159 -
160 series: [ 145 series: [
161 { 146 {
162 name: "사망률", 147 name: "사망률",
...@@ -173,11 +158,9 @@ plotOptions: { ...@@ -173,11 +158,9 @@ plotOptions: {
173 }) 158 })
174 i++; 159 i++;
175 } 160 }
176 -
177 <% probArr.forEach((probArr) => {%> 161 <% probArr.forEach((probArr) => {%>
178 var temp; 162 var temp;
179 temp = <%=probArr %>; 163 temp = <%=probArr %>;
180 -
181 // for(;j<10;j++) 164 // for(;j<10;j++)
182 // { 165 // {
183 // deathArr.push({ 166 // deathArr.push({
...@@ -186,25 +169,18 @@ plotOptions: { ...@@ -186,25 +169,18 @@ plotOptions: {
186 // }) 169 // })
187 // i++; 170 // i++;
188 // } 171 // }
189 -
190 deathArr.push({ 172 deathArr.push({
191 x: time + i * 60000, 173 x: time + i * 60000,
192 y: temp 174 y: temp
193 }) 175 })
194 i++; 176 i++;
195 -
196 <%}) %> 177 <%}) %>
197 -
198 return deathArr; 178 return deathArr;
199 })(), 179 })(),
200 -
201 color: "#FFFFFF" 180 color: "#FFFFFF"
202 } 181 }
203 ] 182 ]
204 -
205 }); 183 });
206 -
207 -
208 var chart2 = Highcharts.chart("container2", { 184 var chart2 = Highcharts.chart("container2", {
209 chart: { 185 chart: {
210 type: "spline", 186 type: "spline",
...@@ -221,23 +197,19 @@ plotOptions: { ...@@ -221,23 +197,19 @@ plotOptions: {
221 // }, 3000); //1000=1초 197 // }, 3000); //1000=1초
222 // } 198 // }
223 // }, 199 // },
224 -
225 backgroundColor: "rgba(255, 255, 255, 0.0)" 200 backgroundColor: "rgba(255, 255, 255, 0.0)"
226 }, 201 },
227 -
228 time: { 202 time: {
229 useUTC: false 203 useUTC: false
230 }, 204 },
231 -
232 title: { 205 title: {
233 text: "기온", 206 text: "기온",
234 style: { 207 style: {
235 color: "#FFFFFF", 208 color: "#FFFFFF",
236 - fontWeight: "bold", 209 + //fontWeight: "bold",
237 - fontFamily: 'Yeon Sung', 210 + fontFamily: 'Do Hyeon',
238 fontSize:'25px' 211 fontSize:'25px'
239 } 212 }
240 -
241 }, 213 },
242 xAxis: { 214 xAxis: {
243 type: "datetime", 215 type: "datetime",
...@@ -267,7 +239,6 @@ plotOptions: { ...@@ -267,7 +239,6 @@ plotOptions: {
267 color: "white" 239 color: "white"
268 } 240 }
269 } 241 }
270 -
271 }, 242 },
272 tooltip: { 243 tooltip: {
273 headerFormat: "<b>{series.name}</b><br/>", 244 headerFormat: "<b>{series.name}</b><br/>",
...@@ -305,11 +276,9 @@ plotOptions: { ...@@ -305,11 +276,9 @@ plotOptions: {
305 }) 276 })
306 i++; 277 i++;
307 } 278 }
308 -
309 <% ptArr.forEach((ptArr) => {%> 279 <% ptArr.forEach((ptArr) => {%>
310 var temp; 280 var temp;
311 temp = <%=ptArr %>; 281 temp = <%=ptArr %>;
312 -
313 // for(j;j<10;j++) 282 // for(j;j<10;j++)
314 // { 283 // {
315 // tempArr.push({ 284 // tempArr.push({
...@@ -318,23 +287,18 @@ plotOptions: { ...@@ -318,23 +287,18 @@ plotOptions: {
318 // }) 287 // })
319 // i++; 288 // i++;
320 // } 289 // }
321 -
322 tempArr.push({ 290 tempArr.push({
323 x: time + i * 60000, 291 x: time + i * 60000,
324 y: temp 292 y: temp
325 }) 293 })
326 i++; 294 i++;
327 -
328 <%}) %> 295 <%}) %>
329 -
330 return tempArr; 296 return tempArr;
331 })(), 297 })(),
332 -
333 color: "#FFE08C" 298 color: "#FFE08C"
334 } 299 }
335 ] 300 ]
336 }); 301 });
337 -
338 var chart3 = Highcharts.chart("container3", { 302 var chart3 = Highcharts.chart("container3", {
339 chart: { 303 chart: {
340 type: "spline", 304 type: "spline",
...@@ -353,17 +317,15 @@ plotOptions: { ...@@ -353,17 +317,15 @@ plotOptions: {
353 // }, 317 // },
354 backgroundColor: "rgba(255, 255, 255, 0.0)" 318 backgroundColor: "rgba(255, 255, 255, 0.0)"
355 }, 319 },
356 -
357 time: { 320 time: {
358 useUTC: false 321 useUTC: false
359 }, 322 },
360 -
361 title: { 323 title: {
362 text: "풍속", 324 text: "풍속",
363 style: { 325 style: {
364 color: "#FFFFFF", 326 color: "#FFFFFF",
365 - fontWeight: "bold", 327 + //fontWeight: "bold",
366 - fontFamily: 'Yeon Sung', 328 + fontFamily: 'Do Hyeon',
367 fontSize:'25px' 329 fontSize:'25px'
368 } 330 }
369 }, 331 },
...@@ -395,7 +357,6 @@ plotOptions: { ...@@ -395,7 +357,6 @@ plotOptions: {
395 color: "white" 357 color: "white"
396 } 358 }
397 } 359 }
398 -
399 }, 360 },
400 tooltip: { 361 tooltip: {
401 headerFormat: "<b>{series.name}</b><br/>", 362 headerFormat: "<b>{series.name}</b><br/>",
...@@ -433,11 +394,9 @@ plotOptions: { ...@@ -433,11 +394,9 @@ plotOptions: {
433 }) 394 })
434 i++; 395 i++;
435 } 396 }
436 -
437 <% wsArr.forEach((wsArr) => {%> 397 <% wsArr.forEach((wsArr) => {%>
438 var temp; 398 var temp;
439 temp = <%=wsArr %>; 399 temp = <%=wsArr %>;
440 -
441 // for(j;j<10;j++) 400 // for(j;j<10;j++)
442 // { 401 // {
443 // windArr.push({ 402 // windArr.push({
...@@ -446,22 +405,17 @@ plotOptions: { ...@@ -446,22 +405,17 @@ plotOptions: {
446 // }) 405 // })
447 // i++; 406 // i++;
448 // } 407 // }
449 -
450 windArr.push({ 408 windArr.push({
451 x: time + i * 60000, 409 x: time + i * 60000,
452 y: temp 410 y: temp
453 }) 411 })
454 i++; 412 i++;
455 -
456 <%}) %> 413 <%}) %>
457 -
458 return windArr; 414 return windArr;
459 })(), 415 })(),
460 -
461 color: "#FFE08C" 416 color: "#FFE08C"
462 } 417 }
463 ] }); 418 ] });
464 -
465 var chart4 = Highcharts.chart("container4", { 419 var chart4 = Highcharts.chart("container4", {
466 chart: { 420 chart: {
467 type: "spline", 421 type: "spline",
...@@ -480,17 +434,15 @@ plotOptions: { ...@@ -480,17 +434,15 @@ plotOptions: {
480 // }, 434 // },
481 backgroundColor: "rgba(255, 255, 255, 0.0)" 435 backgroundColor: "rgba(255, 255, 255, 0.0)"
482 }, 436 },
483 -
484 time: { 437 time: {
485 useUTC: false 438 useUTC: false
486 }, 439 },
487 -
488 title: { 440 title: {
489 text: "강수량", 441 text: "강수량",
490 style: { 442 style: {
491 color: "#FFFFFF", 443 color: "#FFFFFF",
492 - fontWeight: "bold", 444 + //fontWeight: "bold",
493 - fontFamily: 'Yeon Sung', 445 + fontFamily: 'Do Hyeon',
494 fontSize:'25px' 446 fontSize:'25px'
495 } 447 }
496 }, 448 },
...@@ -522,7 +474,6 @@ plotOptions: { ...@@ -522,7 +474,6 @@ plotOptions: {
522 color: "white" 474 color: "white"
523 } 475 }
524 } 476 }
525 -
526 }, 477 },
527 tooltip: { 478 tooltip: {
528 headerFormat: "<b>{series.name}</b><br/>", 479 headerFormat: "<b>{series.name}</b><br/>",
...@@ -560,11 +511,9 @@ plotOptions: { ...@@ -560,11 +511,9 @@ plotOptions: {
560 }) 511 })
561 i++; 512 i++;
562 } 513 }
563 -
564 <% rainArr.forEach((rainArr) => {%> 514 <% rainArr.forEach((rainArr) => {%>
565 var temp; 515 var temp;
566 temp = <%=rainArr %>; 516 temp = <%=rainArr %>;
567 -
568 // for(j;j<10;j++) 517 // for(j;j<10;j++)
569 // { 518 // {
570 // rainArr.push({ 519 // rainArr.push({
...@@ -573,32 +522,141 @@ plotOptions: { ...@@ -573,32 +522,141 @@ plotOptions: {
573 // }) 522 // })
574 // i++; 523 // i++;
575 // } 524 // }
576 -
577 rainArr.push({ 525 rainArr.push({
578 x: time + i * 60000, 526 x: time + i * 60000,
579 y: temp 527 y: temp
580 528
581 }) 529 })
582 i++; 530 i++;
583 -
584 <%}) %> 531 <%}) %>
585 -
586 return rainArr; 532 return rainArr;
587 })(), 533 })(),
588 color: "#FFE08C" 534 color: "#FFE08C"
589 -
590 } 535 }
591 ] 536 ]
592 -
593 -
594 }); 537 });
538 + var chart5 = Highcharts.chart("container5", {
539 + chart: {
540 + type: "spline",
541 + animation: Highcharts.svg, // don't animate in old IE
542 + marginRight: 10,
543 + // events: {
544 + // load: function () {
545 + // // set up the updating of the chart each second
546 + // var series = this.series[0];
547 + // setInterval(function () {
548 + // var x = new Date().getTime(), // 현재 시간
549 + // y = Math.random(); //
550 + // series.addPoint([x, y], true, true);
551 + // }, 3000); //1000=1초
552 + // }
553 + // },
554 + backgroundColor: "rgba(255, 255, 255, 0.0)"
555 + },
556 + time: {
557 + useUTC: false
558 + },
559 + title: {
560 + text: "교통사고",
561 + style: {
562 + color: "#FFFFFF",
563 + //fontWeight: "bold",
564 + fontFamily: 'Do Hyeon',
565 + fontSize:'25px'
566 + }
567 + },
568 + xAxis: {
569 + type: "datetime",
570 + tickPixelInterval: 150,
571 + labels: {
572 + style: {
573 + color: "white"
574 + }
575 + }
576 + },
577 + yAxis: {
578 + title: {
579 + text: "교통사고발생횟수(번)",
580 + style: {
581 + color: "white"
582 + }
583 + },
584 + plotLines: [
585 + {
586 + value: 0,
587 + width: 1,
588 + color: "#808080"
589 + }
590 + ],
591 + labels: {
592 + style: {
593 + color: "white"
594 + }
595 + }
596 + },
597 + tooltip: {
598 + headerFormat: "<b>{series.name}</b><br/>",
599 + pointFormat: "{point.x:%Y년%m월%d일 %H시%M분}<br/>의 교통사고 발생 수 : {point.y:.2f}m/s"
600 + },
601 + legend: {
602 + //enabled: false
603 + layout: "vertical",
604 + align: "left",
605 + verticalAlign: "top",
606 + x: 100,
607 + y: 50,
608 + floating: true,
609 + borderWidth: 1,
610 + backgroundColor:
611 + (Highcharts.theme && Highcharts.theme.legendBackgroundColor) ||
612 + "#FFFFFF"
613 + },
614 + exporting: {
615 + enabled: false
616 + },
617 + series: [
618 + {
619 + name: "교통사고 발생수",
620 + data: (function () {
621 + var trafficArr = [], //windArr
622 + time = new Date().getTime();
623 + var length = <%=dataLen%>;
624 + var i = -9;
625 + var j = 0;
626 + for (j; j < 10 - length; j++) {
627 + trafficArr.push({
628 + x: time + i * 60000,
629 + y: 0
630 + })
631 + i++;
632 + }
633 + <% occurArr.forEach((occurArr) => {%>
634 + var temp;
635 + temp = <%=occurArr %>;
636 + // for(j;j<10;j++)
637 + // {
638 + // trafficArr.push({
639 + // x: time + i * 60000,
640 + // y: temp
641 + // })
642 + // i++;
643 + // }
644 + trafficArr.push({
645 + x: time + i * 60000,
646 + y: temp
647 + })
648 + i++;
649 + <%}) %>
650 + return trafficArr;
651 + })(),
652 + color: "#FFE08C"
653 + }
654 + ] });
595 var socket = io.connect('/', { transports: ['websocket'], upgrade: false }); 655 var socket = io.connect('/', { transports: ['websocket'], upgrade: false });
596 socket.emit("connection", client_data); 656 socket.emit("connection", client_data);
597 - socket.on("weatherInfo_minutely_send_to_client", (info) => { //서버에서 client에게 메세지 전송 657 + socket.on("weather_and_traffic_Info_minutely_send_to_client", (info) => { //서버에서 client에게 메세지 전송
598 console.log(info); 658 console.log(info);
599 -
600 var date = new Date().getTime(); 659 var date = new Date().getTime();
601 -
602 chart1.series[0].addPoint({ 660 chart1.series[0].addPoint({
603 x: date, 661 x: date,
604 y: info.death, 662 y: info.death,
...@@ -609,24 +667,23 @@ plotOptions: { ...@@ -609,24 +667,23 @@ plotOptions: {
609 y: info.temperature*1, 667 y: info.temperature*1,
610 color:"#FFE08C" 668 color:"#FFE08C"
611 }); 669 });
612 -
613 chart3.series[0].addPoint({ 670 chart3.series[0].addPoint({
614 x: date, 671 x: date,
615 y: info.wind*1, 672 y: info.wind*1,
616 color:"#FFE08C" 673 color:"#FFE08C"
617 }); 674 });
618 -
619 chart4.series[0].addPoint({ 675 chart4.series[0].addPoint({
620 x: date, 676 x: date,
621 y: info.rain*1, 677 y: info.rain*1,
622 color:"#FFE08C" 678 color:"#FFE08C"
623 }); 679 });
624 - 680 + chart5.series[0].addPoint({
681 + x: date,
682 + y: info.occurence*1,
683 + color:"#FFE08C"
684 + });
625 }); 685 });
626 -
627 </script> 686 </script>
628 </div> 687 </div>
629 -
630 </body> 688 </body>
631 -
632 </html> 689 </html>
...\ No newline at end of file ...\ No newline at end of file
......
1 -<!DOCTYPE <!DOCTYPE html> 1 +<!DOCTYPE
2 +
3 +<!DOCTYPE html>
2 <html> 4 <html>
3 5
4 -<head> 6 + <head>
5 <meta charset="utf-8" /> 7 <meta charset="utf-8" />
6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 8 <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 <title>Page Title</title> 9 <title>Page Title</title>
...@@ -9,7 +11,7 @@ ...@@ -9,7 +11,7 @@
9 <!-- font --> 11 <!-- font -->
10 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet"> 12 <link href="https://fonts.googleapis.com/css?family=Nanum+Brush+Script&amp;subset=korean" rel="stylesheet">
11 <link href="https://fonts.googleapis.com/css?family=Yeon+Sung&amp;subset=korean" rel="stylesheet"> 13 <link href="https://fonts.googleapis.com/css?family=Yeon+Sung&amp;subset=korean" rel="stylesheet">
12 - 14 + <link href="https://fonts.googleapis.com/css?family=Do+Hyeon&display=swap" rel="stylesheet">
13 <meta name="viewport" content="width=device-width, initial-scale=1"> 15 <meta name="viewport" content="width=device-width, initial-scale=1">
14 <link rel="stylesheet" type="text/css" media="screen" href="main.css" /> 16 <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
15 <script src="main.js"></script> 17 <script src="main.js"></script>
...@@ -42,13 +44,14 @@ ...@@ -42,13 +44,14 @@
42 44
43 h1 { 45 h1 {
44 color: white; 46 color: white;
45 - font-family: 'Nanum Brush Script', cursive; 47 + font-family: 'Do Hyeon', sans-serif;
48 + //font-family: 'Nanum Brush Script', cursive;
46 } 49 }
47 50
48 label { 51 label {
49 color: white; 52 color: white;
50 font-size: 20px; 53 font-size: 20px;
51 - font-family: 'Yeon Sung', cursive; 54 + font-family: 'Do Hyeon', sans-serif;
52 } 55 }
53 56
54 #banner { 57 #banner {
...@@ -63,37 +66,41 @@ ...@@ -63,37 +66,41 @@
63 width: 100%; 66 width: 100%;
64 height: 50px; 67 height: 50px;
65 text-align: center; 68 text-align: center;
66 - font-family: 'Yeon Sung', cursive; 69 + font-family: 'Do Hyeon', sans-serif;
67 color: white; 70 color: white;
68 } 71 }
69 </style> 72 </style>
70 73
71 -</head> 74 + </head>
72 75
73 -<body> 76 + <body>
74 - <img src="images/background.jpg" alt="" style="z-index:-1; min-width: 100%; min-height: 100%"> 77 + <img src="images/newbackground.png" alt="" style="z-index:-1; min-width: 100%; min-height: 100%">
75 <div id="banner"> 78 <div id="banner">
76 <div style="width:100%; text-align: center; padding-top:170px;"> 79 <div style="width:100%; text-align: center; padding-top:170px;">
77 <h1 style="font-size:90px;">당신이 지금 죽을 확률은?</h1> 80 <h1 style="font-size:90px;">당신이 지금 죽을 확률은?</h1>
78 </div> 81 </div>
79 - <br><br><br> 82 + <br>
83 + <br>
84 + <br>
80 <div style="width:100%; text-align: center;"> 85 <div style="width:100%; text-align: center;">
81 <form action="/starting" method="post"> 86 <form action="/starting" method="post">
82 <div class="form-inline"> 87 <div class="form-inline">
83 <label>이름</label> 88 <label>이름</label>
84 - <input type="text" name="name" class="form-control" placeholder="김철수" style="width:200px;"> 89 + <input type="text" name="name" class="form-control" placeholder="조인화" style="width:200px;">
85 &nbsp &nbsp&nbsp&nbsp 90 &nbsp &nbsp&nbsp&nbsp
86 <label>생년월일</label> 91 <label>생년월일</label>
87 - <input type="text" name="birth" class="form-control" placeholder="971009" style="width:200px;"> 92 + <input type="text" name="birth" class="form-control" placeholder="991025" style="width:200px;">
88 - <br><br><br> 93 + <br>
89 - <input type="submit" value="시작하기" class="btn btn-default" style="font-family: 'Yeon Sung', cursive; width:100px;font-weight: bold; font-size: 18px; background-color: white;"> 94 + <br>
95 + <br>
96 + <input type="submit" value="시작하기" class="btn btn-default" style="font-family: 'Do Hyeon', sans-serif; width:100px;font-weight: bold; font-size: 18px; background-color: white;">
90 </div> 97 </div>
91 </form> 98 </form>
92 </div> 99 </div>
93 100
94 </div> 101 </div>
95 102
96 - <div id="footer">오픈소스SW개발 조민지 강환석 배희수</div> 103 + <div id="footer">오픈소스SW개발 김주희 김윤지 조인화</div>
97 -</body> 104 + </body>
98 105
99 </html> 106 </html>
...\ No newline at end of file ...\ No newline at end of file
......