-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindia.html
235 lines (203 loc) · 7.8 KB
/
india.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="1024, initial-scale=1.0">
<title>India Statistics</title>
<link rel="icon" href="images/corona1.webp" type="image/webp" sizes="16x16">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script>src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script>
alert("View the site in Landscape Mode on Mobiles");
</script>
<style>
#container { display:block; }
@media only screen and (orientation:portrait){
#container {
height: 100vw;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
}
@media only screen and (orientation:landscape){
#container {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
}
</style>
</head>
<body style="background-color:whitesmoke" id="container">
<h1 style="text-align: center;font-family: Roboto;">Cases Timeline - India</h1>
<h4 style="text-align: center;font-family: Roboto;">(Click/Tap the points/bars below for exact number)</h4>
<div style="width: 80%;height: 100%;margin-left: 10%;" ><canvas id="myChart" width="400" height="200" ></canvas></div>
<br>
<div class="container">
<div class="col-lg-6 col-md-12 col-12">
<canvas id="myChart1" width="400" height="200" ></canvas>
</div>
<div class="col-lg-6 col-md-12 col-12">
<canvas id="myChart2" width="400" height="200" "></canvas>
</div>
</div>
<div class="table-responsive" style="font-family: Roboto;font-size: large;font-weight: 700;" >
<table class="table" id="stateWise">
<colgroup>
<col style="background-color:white">
<col style="background-color:yellow">
<col style="background-color: rgb(74, 184, 184)">
<col style="background-color: tomato;">
<col style="background-color: rgb(58, 204, 44);">
</colgroup>
<thead>
<tr style="font-size: larger; ">
<th class=" verticalSplit bg-dark" style="color: white;padding-left: 3rem;">States</th>
<th class=" verticalSplit bg-dark" style="color: white;text-align: center;">Confirmed</th>
<th class=" verticalSplit bg-dark" style="color: white;text-align: center;">Active</th>
<th class=" verticalSplit bg-dark" style="color: white;text-align: center;">Deaths</th>
<th class=" verticalSplit bg-dark" style="color: white;text-align: center;">Recovered</th>
</tr>
</thead>
</table>
</div>
<script>
// world's country wise stats--> "https://api.covid19api.com/";
// india's overall stats --> https://coronavirus-19-api.herokuapp.com/countries/india
// india's district wise stats --> https://api.covid19india.org/state_district_wise.json -->https://api.covid19india.org/data.json
const url="https://api.covid19india.org/data.json";
const xlabels=[];const ylabels=[];const y1labels=[];const y2labels=[];const y3labels=[];
const x2labels=[];const y4labels=[];
async function getData(){
const response= await fetch(url);
const data=await response.json();
console.log(data);
const stateWise=document.getElementById('stateWise');
for(var i=0;i<data.cases_time_series.length;i=i+1)
{
xlabels.push(data.cases_time_series[i].date);
}
for(var i=0;i<data.cases_time_series.length;i=i+1)
{
ylabels.push(data.cases_time_series[i].totalconfirmed);
y1labels.push(data.cases_time_series[i].totalrecovered);
y2labels.push(data.cases_time_series[i].totaldeceased);
y3labels.push(data.cases_time_series[i].dailyconfirmed);
}
for(var i=1;i<=10;i++)
{
x2labels.push(data.statewise[i].state);
y4labels.push(data.statewise[i].confirmed);
}
for(var i=1;i<=38;i++)
{
var x=stateWise.insertRow();
x.insertCell(0);
stateWise.rows[i].cells[0].innerHTML=data.statewise[i-1].state;
x.insertCell(1);
stateWise.rows[i].cells[1].innerHTML=data.statewise[i-1].confirmed;
x.insertCell(2);
stateWise.rows[i].cells[2].innerHTML=data.statewise[i-1].active;
x.insertCell(3);
stateWise.rows[i].cells[3].innerHTML=data.statewise[i-1].deaths;
x.insertCell(4);
stateWise.rows[i].cells[4].innerHTML=data.statewise[i-1].recovered;
}
}
getData();
// -->> chart .js
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: xlabels,
datasets: [{
label: 'Number of confirmed cases in india',
data: ylabels,
fill: false,
backgroundColor: 'yellow',
borderWidth: 1
},{
label: 'Number of recovered cases in India',
data: y1labels,
fill: false,
backgroundColor: ' rgb(58, 204, 44)',
borderWidth: 1
},{
label: 'Number of deaths in India',
data: y2labels,
fill: false,
backgroundColor: 'tomato',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
var ctx = document.getElementById('myChart1').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: xlabels,
datasets: [{
label: 'Daily confirmed cases in india(Double Click/Tap to Update)',
data: y3labels,
fill: false,
backgroundColor: 'rgb(201, 56, 201)',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
var ctx = document.getElementById('myChart2').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: x2labels,
datasets: [{
label: 'States with most no. of cases(Double Click/Tap to Update)',
data: y4labels,
fill: false,
backgroundColor: 'red',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
</body>
</html>