-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubdist_old.html
248 lines (169 loc) · 5.38 KB
/
subdist_old.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
236
237
238
239
240
241
242
243
244
245
246
247
248
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="leaflet/leaflet.css"/>
<script src="leaflet/leaflet.js"></script>
<script src="districts_729.js"></script>
<script src="states.js"></script>
<script src="tabletop.js"></script>
<title>India Corona Live Update District</title>
<style>
#map{ height: 550px; }
/*Legend specific*/
.legend {
padding: 6px 8px;
font: 14px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255, 255, 255, 0.8);
/*box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);*/
/*border-radius: 5px;*/
line-height: 24px;
color: #555;
}
.legend h4 {
text-align: center;
font-size: 16px;
margin: 2px 12px 8px;
color: #777;
}
.legend span {
position: relative;
bottom: 3px;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin: 0 8px 0 0;
opacity: 0.7;
}
.legend i.icon {
background-size: 18px;
background-color: rgba(255, 255, 255, 1);
}
</style>
</head>
<body>
<h2 align="center">LIVE CORONA MAP OF INDIA (DISTRICT) </h2>
<p id="date" align="center"></p>
<div id="map"></div>
<div id="demo"> </div>
<div id="demo1"> </div>
<div id="demo2"> </div>
<div id="demo3"> </div>
<div id="demo4"> </div>
<div id="demo5"> </div>
<script>
arr1=[]
arr2=[]
arr3=[]
arr4=[]
arr5=[]
Tabletop.init( { key: "1AL1cj_33m3D7JkT-_wPB7LPJAqIfV2Y5XVMui7nczy4", callback: getdata, simpleSheet: false } );
function getdata(d, tabletop) {
var data, metadata = [];
data = tabletop.sheets("raw").elements;
metadata = tabletop.sheets("readme").elements;
for ( var i = 0; i < data.length; i++ ){
arr1.push(data[i]["District"])
arr2.push(data[i]["Confirmed Cases"])
arr3.push(data[i]["Discharged"])
arr4.push(data[i]["Deaths"])
arr5.push(data[i]["Active"])
}
document.getElementById("demo").innerHTML = arr1
document.getElementById("demo1").innerHTML = arr2
document.getElementById("demo2").innerHTML = arr3
document.getElementById("demo3").innerHTML = arr4
document.getElementById("demo4").innerHTML = arr5
document.getElementById("demo").style.visibility = "hidden";
document.getElementById("demo1").style.visibility = "hidden";
document.getElementById("demo2").style.visibility = "hidden";
document.getElementById("demo3").style.visibility = "hidden";
document.getElementById("demo4").style.visibility = "hidden";
}
var map = L.map('map').setView([23.076748, 78.292226 ], 5);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
function getColor(d) {
return d >= 0 && d <5 ? '#DC143C' :
d > 5 && d < 10 ? '#800026' :
d > 10 && d<15 ? '#8b0023' :
d > 15 ? '#000000' :
'#000000';
}
setTimeout(function(){
var arr7=document.getElementById("demo").innerHTML;
var arr8=document.getElementById("demo1").innerHTML;
var arr9=document.getElementById("demo2").innerHTML;
var arr10=document.getElementById("demo3").innerHTML;
var arr11=document.getElementById("demo4").innerHTML;
arr7=arr7.split(",");
console.log(arr7)
arr8=arr8.split(",");
arr9=arr9.split(",");
arr10=arr10.split(",");
arr11=arr11.split(",");
function style(feature) {
var color = "#feebe2";
for (var i in arr7)
{
if(arr7[i] == feature.properties.dtname)
{
if (arr8[i] > 20) color = "#000000";
else if (arr8[i] > 10 && arr8[i] <= 20 ) color = "#8b0023";
else if (arr8[i] > 5 && arr8[i] <= 10) color = "#800026";
else if (arr8[i] >= 1 && arr8[i] <= 5) color = "#DC143C";
else {color = "#feebe2";}
return {
fillColor: color,
weight: 1,
opacity: 0.4,
color: 'black',
dashArray: '1',
fillOpacity: 0.7,
};
}
}
}
function style1(feature)
{
return{
weight: 1,
opacity: 0.9,
color: "#000",
fill: false
};
}
L.geoJson(geodist, {
style: style,
onEachFeature: function (feature, layer) {
for (var i in arr7)
{
if(arr7[i] == feature.properties.dtname)
{
layer.bindPopup("<p>State: "+ feature.properties.stname +" <br> District :" + feature.properties.dtname +" <br> Confirmed :" + arr8[i] + "<br> Discharged " + arr9[i] + "<br> Death: " + arr10[i] + "<br> Active: " + arr11[i] + "<br></p>")}}}
}).addTo(map);
L.geoJson(geoStates,{
style: style1}).addTo(map)
}, 5000);
var legend = L.control({ position: "bottomleft" });
legend.onAdd = function(map) {
var div = L.DomUtil.create("div", "legend");
div.innerHTML += "<h4>As per Infected Indian</h4>";
div.innerHTML += '<i style="background:#000000"></i><span>20+</span><br>';
div.innerHTML += '<i style="background: #800026"></i><span>5-20</span><br>';
div.innerHTML += '<i style="background: #DC143C"></i><span>0-5</span><br>';
div.innerHTML += '<i style="background: #0000FF"></i><span>No patient</span><br>';
//div.innerHTML += '<i style="background: #FF4500"></i><span>Residential</span><br>';
//div.innerHTML += '<i style="background: #FFFFFF"></i><span>Ice</span><br>';
//div.innerHTML += '<i class="icon" style="background-image: url(https://d30y9cdsu7xlg0.cloudfront.net/png/194515-200.png);background-repeat: no-repeat;"></i><span>Grænse</span><br>';
return div;
};
legend.addTo(map);
</script>
</body>
</html>