-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (98 loc) · 2.28 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/touch.js"></script>
<script type="text/javascript" src="js/underscore-min.js"></script>
<script type="text/javascript" src="js/moment.js"></script>
<script type="text/javascript" src="js/easeljs-NEXT.combined.js"></script>
<script type="text/javascript" src="js/lineForm.js"></script>
</head>
<body>
<div id="target"></div>
</body>
</html>
<script>
var data={
"收缩压":{
title:"血压.收缩压",
unitName:"mmHg",
color:"#ffcd35",
data:[{value:10,time:"2016-06-22 13:54"},{value:120,time:"2016-06-21 13:54"},{value:50,time:"2016-06-25 13:54"}],
max:180,
min:30
},
"舒张压":{
title:"血压.舒张压",
unitName:"mmHg",
color:"#009df4",
data:[{value:10,time:"2016-06-22 13:54"},{value:120,time:"2016-06-21 13:54"},{value:50,time:"2016-06-25 13:54"}],
max:180,
min:30
},
"空腹血糖":{
title:"血糖.空腹血糖",
unitName:"mmol/L",
color:"#ffcd35",
data:[{value:10,time:"2016-06-22 13:54"},{value:120,time:"2016-06-21 13:54"},{value:50,time:"2016-06-25 13:54"}],
max:180,
min:30
},
"静脉血氧":{
title:"血氧.静脉血氧",
unitName:"%",
color:"#009df4",
data:[{value:10,time:"2016-06-22 13:54"},{value:120,time:"2016-06-21 13:54"},{value:50,time:"2016-06-25 13:54"}],
max:180,
min:30
}
}
var callback=function(returnData,id){
var resultTime=0;
var resultObj={};
var showObj={};
$.each(data[id].data,function(i,n){
var space=Number(moment(n.time,"YYYY-MM-DD HH:mm").format("x"));
if(space<=returnData){
if(!resultTime){
resultTime=space;
resultObj=n;
}else{
if(space>resultTime){
resultTime=space;
resultObj=n;
}
}
}
});
resultTime=moment(resultTime,"x").format("YYYY-MM-DD HH:mm");
$.each(data,function(i,n){
$.each(n.data,function(o,p){
if(p.time==resultTime){
showObj[i]=p;
}
});
});
debugger;
}
$.each(data,function(i,n){
var line=new lineForm({
target:"#target",
title:n.title,
unitName:n.unitName,
color:n.color,
w:750,
h:300
});
line.callback=function(returnData){
callback(returnData,i);
}
line.set({
data:n.data,
max:n.max,
min:n.min
});
});
</script>