forked from Anujarya300/bubble_maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindia.html
86 lines (82 loc) · 2.95 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
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="https://rawgit.com/Anujarya300/bubble_maps/master/data/geography-data/datamaps.none.js"></script>
<div id="india" style="height: 600px; width: 900px;"></div>
<script>
var bubble_map = new Datamap({
element: document.getElementById('india'),
scope: 'india',
geographyConfig: {
popupOnHover: true,
highlightOnHover: true,
borderColor: '#444',
borderWidth: 0.5,
dataUrl: './data/geography-data/india.toto.json',
popupTemplate: function (geo, data) {
return `<div class="hoverinfo">city: ${data.state}, Slums: ${data.percent}%</div>`;
}
//dataJson: topoJsonData
},
fills: {
'MAJOR': '#306596',
'MEDIUM': '#0fa0fa',
'MINOR': '#bada55',
defaultFill: '#dddddd'
},
data: {
'ML': {
fillKey: 'MINOR',
percent: 70,
state: 'Meghalaya'
},
'MH': {
fillKey: 'MEDIUM',
percent: 70,
state: 'Maharashtra'
},
'PB': {
fillKey: 'MINOR',
percent: 70,
state: 'Punjab'
},
'SK': {
fillKey: 'MINOR',
percent: 70,
state: 'Sikkim'
},
'PY': {
fillKey: 'MEDIUM',
percent: 70,
state: 'Puducherry'
},
'UP': {
fillKey: 'MAJOR',
percent: 70,
state: 'Uttar Pradesh'
}
},
setProjection: function (element) {
var projection = d3.geo.mercator()
.center([78.9629, 23.5937]) // always in [East Latitude, North Longitude]
.scale(700);
var path = d3.geo.path().projection(projection);
return { path: path, projection: projection };
}
});
let bubbles = [
]
// // ISO ID code for city or <state></state>
setTimeout(() => { // only start drawing bubbles on the map when map has rendered completely.
// bubble_map.bubbles(bubbles, {
// popupTemplate: function (geo, data) {
// debugger;
// return `<div class="hoverinfo">city: ${data.state}, Slums: ${data.radius}%</div>`;
// }
// });
}, 1000);
</script>
</body>
</html>