-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataitem.js
94 lines (75 loc) · 2.62 KB
/
dataitem.js
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
var DataItem = {
};
DataItem.IsParent = function() {
return !("ChildName" in this)
}
DataItem.Name = function() {
return this.IsParent()? this.ParentName: this.ParentName + "-" + this.ChildName;
}
DataItem.Get = function(col) {
var item = this;
var name = col in item? col: ( "ChildName" in item? "Child" + col: "Parent" + col);
var r = Number.NaN;
if (name in item) {
if (typeof item[name] == "function") {
r = item[name].call(item);
}
else {
r = item[name]
}
}
return r == 0 || r? r : Number.NaN;
}
DataItem.TreatingCount = function(v) {
return this.Get("ConfirmedCount") - this.Get("CuredCount")- this.Get("DeadCount");
}
DataItem.CuredRate = function(v) {
return valueDiv(this.Get("CuredCount") , this.Get("ConfirmedCount"));
}
DataItem.DeadRate = function(v) {
return valueDiv(this.Get("DeadCount"), this.Get("ConfirmedCount"));
}
DataItem.TreatingRate = function(v) {
return valueDiv(this.Get("TreatingCount"), this.Get("ConfirmedCount"));
}
DataItem.DeadDivideCured = function(v) {
return valueDiv(this.Get("DeadCount") , this.Get("CuredCount"));
}
DataItem.CuredDivideDead = function(v) {
return valueDiv(this.Get("CuredCount") , this.Get("DeadCount"));
}
var DataItem2 = {
};
DataItem2.ConfirmedNorm = function(v) {
return valueNorm(this.Get("ConfirmedCount") ,this.Count.MinConfirmedCount, this.Count.MaxConfirmedCount);
}
DataItem2.CuredNorm = function(v) {
return valueNorm(this.Get("CuredCount") ,this.Count.MinCuredCount, this.Count.MaxCuredCount);
}
DataItem2.DeadNorm = function(v) {
return valueNorm(this.Get("DeadCount") ,this.Count.MinDeadCount, this.Count.MaxDeadCount);
}
DataItem2.TreatingNorm = function(v) {
return valueNorm(this.Get("TreatingCount") ,this.Count.MinTreatingCount, this.Count.MaxTreatingCount);
}
DataItem2.DeadRateEx = function(v) {
return valueCalcRate(this.Get("DeadCount"), this.Get("CuredCount"));
}
DataItem2.CuredRateEx = function(v) {
return valueCalcRate(this.Get("CuredCount"), this.Get("DeadCount"));
}
//DataItem.TatalConfirmedNorm = function(v) {
// return this.Get("CuredCount") / this.Get("ConfirmedCount");
//}
//DataItem.TatalSuspectedNorm = function(v) {
// return this.Get("CuredCount") / this.Get("ConfirmedCount");
//}
//DataItem.TatalCuredNorm = function(v) {
// return this.Get("CuredCount") / this.Get("ConfirmedCount");
//}
//DataItem.TatalDeadNorm = function(v) {
// return this.Get("CuredCount") / this.Get("ConfirmedCount");
//}
//DataItem.TatalTreatingNorm = function(v) {
// return this.Get("CuredCount") / this.Get("ConfirmedCount");
//}