조민지

소켓에서 받을 때 마다 AddPoint

...@@ -39,13 +39,30 @@ ...@@ -39,13 +39,30 @@
39 39
40 var date = new Date().getTime(); 40 var date = new Date().getTime();
41 41
42 - chart1.series.data.push({ 42 + chart1.series[0].addPoint({
43 x: date, 43 x: date,
44 y: info.death 44 y: info.death
45 }) 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 + })
61 +
46 }); 62 });
47 </script> 63 </script>
48 <script type="text/javascript"> 64 <script type="text/javascript">
65 + //사망률
49 var chart1 = Highcharts.chart("container1", { 66 var chart1 = Highcharts.chart("container1", {
50 chart: { 67 chart: {
51 type: "areaspline", 68 type: "areaspline",
...@@ -150,23 +167,23 @@ ...@@ -150,23 +167,23 @@
150 } 167 }
151 ] 168 ]
152 }); 169 });
153 - 170 + //기온
154 var chart2 = Highcharts.chart("container2", { 171 var chart2 = Highcharts.chart("container2", {
155 chart: { 172 chart: {
156 type: "spline", 173 type: "spline",
157 animation: Highcharts.svg, // don't animate in old IE 174 animation: Highcharts.svg, // don't animate in old IE
158 marginRight: 10, 175 marginRight: 10,
159 - events: { 176 + // events: {
160 - load: function () { 177 + // load: function () {
161 - // set up the updating of the chart each second 178 + // // set up the updating of the chart each second
162 - var series = this.series[0]; 179 + // var series = this.series[0];
163 - setInterval(function () { 180 + // setInterval(function () {
164 - var x = new Date().getTime(), // 현재 시간 181 + // var x = new Date().getTime(), // 현재 시간
165 - y = 0; // 182 + // y = 0; //
166 - series.addPoint([x, y], true, true); 183 + // series.addPoint([x, y], true, true);
167 - }, 60000); //1000=1초 184 + // }, 60000); //1000=1초
168 - } 185 + // }
169 - } 186 + // }
170 }, 187 },
171 188
172 time: { 189 time: {
...@@ -255,23 +272,23 @@ ...@@ -255,23 +272,23 @@
255 } 272 }
256 ] 273 ]
257 }); 274 });
258 - 275 + //풍속
259 var chart3 = Highcharts.chart("container3", { 276 var chart3 = Highcharts.chart("container3", {
260 chart: { 277 chart: {
261 type: "spline", 278 type: "spline",
262 animation: Highcharts.svg, // don't animate in old IE 279 animation: Highcharts.svg, // don't animate in old IE
263 marginRight: 10, 280 marginRight: 10,
264 - events: { 281 + // events: {
265 - load: function () { 282 + // load: function () {
266 - // set up the updating of the chart each second 283 + // // set up the updating of the chart each second
267 - var series = this.series[0]; 284 + // var series = this.series[0];
268 - setInterval(function () { 285 + // setInterval(function () {
269 - var x = new Date().getTime(), // 현재 시간 286 + // var x = new Date().getTime(), // 현재 시간
270 - y = 0; // 287 + // y = 0; //
271 - series.addPoint([x, y], true, true); 288 + // series.addPoint([x, y], true, true);
272 - }, 60000); //1000=1초 289 + // }, 60000); //1000=1초
273 - } 290 + // }
274 - } 291 + // }
275 }, 292 },
276 293
277 time: { 294 time: {
...@@ -360,23 +377,23 @@ ...@@ -360,23 +377,23 @@
360 } 377 }
361 ] 378 ]
362 }); 379 });
363 - 380 + //강수량
364 var chart4 = Highcharts.chart("container4", { 381 var chart4 = Highcharts.chart("container4", {
365 chart: { 382 chart: {
366 type: "spline", 383 type: "spline",
367 animation: Highcharts.svg, // don't animate in old IE 384 animation: Highcharts.svg, // don't animate in old IE
368 marginRight: 10, 385 marginRight: 10,
369 - events: { 386 + // events: {
370 - load: function () { 387 + // load: function () {
371 - // set up the updating of the chart each second 388 + // // set up the updating of the chart each second
372 - var series = this.series[0]; 389 + // var series = this.series[0];
373 - setInterval(function () { 390 + // setInterval(function () {
374 - var x = new Date().getTime(), // 현재 시간 391 + // var x = new Date().getTime(), // 현재 시간
375 - y = 0; // 392 + // y = 0; //
376 - series.addPoint([x, y], true, true); 393 + // series.addPoint([x, y], true, true);
377 - }, 60000); //1000=1초 394 + // }, 60000); //1000=1초
378 - } 395 + // }
379 - } 396 + // }
380 }, 397 },
381 398
382 time: { 399 time: {
......