-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstats.html
97 lines (89 loc) · 4.34 KB
/
stats.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
<!DOCTYPE html>
<html lang="en">
<head>
<script>
var myObj;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
var total_cnf = myObj.statewise[0].confirmed;
document.getElementById("cnf").innerHTML = total_cnf;
var total_act = myObj.statewise[0].active;
document.getElementById("act").innerHTML = total_act;
var total_rec = myObj.statewise[0].recovered;
document.getElementById("rec").innerHTML = total_rec;
var total_dec = myObj.statewise[0].deaths;
document.getElementById("dec").innerHTML = total_dec;
var rec_rate = (total_rec/total_cnf)*100;
document.getElementById("rec_r").innerHTML = rec_rate.toFixed(2) + "%";
var death_rate = (total_dec/total_cnf)*100;
document.getElementById("dec_r").innerHTML = death_rate.toFixed(2) + "%";
var del_cnf = myObj.statewise[0].deltaconfirmed;
document.getElementById("delta_cnf").innerHTML = "[+" + del_cnf + "]";
var del_rec = myObj.statewise[0].deltarecovered;
document.getElementById("delta_rec").innerHTML = "[+" + del_rec + "]";
var del_dec = myObj.statewise[0].deltadeaths;
document.getElementById("delta_dec").innerHTML = "[+" + del_dec + "]";
}
};
xmlhttp.open("GET", "https://api.covid19india.org/data.json", true);
xmlhttp.send();
function showstats(){
}
</script>
<meta charset="UTF-8">
<link rel="icon" href="./icons/icon.ico"/>
<link rel="apple-touch-icon" href="./icons/icon.png"/>
<meta name="theme-color" content="#8CBCFC">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fluentdesignforweb.github.io/normalize.css" type="text/css" rel="stylesheet">
<link href="https://fluentdesignforweb.github.io/fluent.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap" rel="stylesheet">
<link href="./styles/style.css" type="text/css" rel="stylesheet">
<title>Corona Rakshak - National Level Stats</title>
</head>
<body onload="showstats();">
<div id="home_body" class="noscroll_bar">
<div class="column large6 medium8 small12 fullview center">
<div class="page_container">
<br />
<h6>National Stats</h6>
<br />
<button class="tab large6 small12 medium12 confirmed ta_center center zi2">
<label id="delta_cnf" class="ta_center stat"></label>
<p id="cnf" class="ta_center stat hdg"></p>
Confirmed
</button>
<button class="tab large6 small12 medium12 active ta_center center zi2">
<p id="act" class="ta_center stat hdg"></p>
Active
</button>
<button class="tab large6 small12 medium12 recovered ta_center center zi2">
<label id="delta_rec" class="ta_center stat"></label>
<p id="rec" class="ta_center stat hdg"></p>
Recovered
</button>
<button class="tab large6 small12 medium12 deaths ta_center center zi2">
<label id="delta_dec" class="ta_center stat"></label>
<p id="dec" class="ta_center stat hdg"></p>
Deaths
</button>
<button class="tab large3 small6 medium6 rec_rate ta_center zi2">
<p id="rec_r" class="ta_center stat hdg"></p>
Recovery Rate
</button>
<button class="tab large3 small6 medium6 dec_rate ta_center zi2">
<p id="dec_r" class="ta_center stat hdg"></p>
Death Rate
</button>
<br /><br />
<a href="index.html" class="button home_but center" onclick="">Goto Home</a>
<br />
</div>
</div>
</div>
<br />
</body>
</html>