Toggle navigation
Toggle navigation
This project
Loading...
Sign in
kkl
/
Probability Death
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조민지
2018-12-11 23:09:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6bdabf60706ad9e939cb81414a50f897507d6bbe
6bdabf60
1 parent
58a2b7f8
data push
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
views/index.ejs
views/index.ejs
View file @
6bdabf6
...
...
@@ -31,30 +31,37 @@
<script
src=
"/socket.io/socket.io.js"
></script>
<script
type=
"text/javascript"
>
<script>
var
socket
=
io
.
connect
(
'/'
,
{
transports
:
[
'websocket'
],
upgrade
:
false
});
socket
.
emit
(
"connection"
,
"client in"
);
socket
.
on
(
"weatherInfo_minutely_send_to_client"
,
(
info
)
=>
{
//서버에서 client에게 메세지 전송
console
.
log
(
info
);
var
date
=
new
Date
().
getTime
();
chart1
.
series
.
data
.
push
({
x
:
date
,
y
:
info
.
death
})
});
</script>
<script
type=
"text/javascript"
>
var
chart1
=
Highcharts
.
chart
(
"container1"
,
{
chart
:
{
type
:
"areaspline"
,
animation
:
Highcharts
.
svg
,
// don't animate in old IE
marginRight
:
10
,
events
:
{
load
:
function
()
{
// set up the updating of the chart each second
var
series
=
this
.
series
[
0
];
setInterval
(
function
()
{
var
x
=
new
Date
().
getTime
(),
// 현재 시간
y
=
0
;
//여기에 새로 넣을 값
series
.
addPoint
([
x
,
y
],
true
,
true
);
},
60000
);
//1000=1초 -> 1분=60000
}
}
//
events: {
//
load: function () {
//
// set up the updating of the chart each second
//
var series = this.series[0];
//
setInterval(function () {
//
var x = new Date().getTime(), // 현재 시간
//
y = 0; //여기에 새로 넣을 값
//
series.addPoint([x, y], true, true);
//
}, 60000); //1000=1초 -> 1분=60000
//
}
//
}
},
time
:
{
...
...
Please
register
or
login
to post a comment