-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
108 lines (106 loc) · 3.32 KB
/
index.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
<!DOCTYPE html>
<html lang="zh-tw">
<head>
<meta charset="UTF-8" />
<title>台灣登革熱地圖</title>
<meta name="author" content="emma2334" />
<meta
name="description"
content="2003 年至現今台灣各地登革熱狀況統計分析。"
/>
<meta
name="viewport"
content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no"
/>
<!-- og -->
<meta property="og:type" content="website" />
<meta property="og:title" content="台灣登革熱地圖" />
<meta
property="og:description"
content="2003 年至現今台灣各地登革熱狀況統計分析。"
/>
<meta property="og:url" content="https://emma2334.github.io/dengue_tw/" />
<meta property="og:site_name" content="台灣登革熱地圖" />
<meta
property="og:image"
content="https://emma2334.github.io/dengue_tw/og.png"
/>
<!-- Titter og -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="台灣登革熱地圖" />
<meta
name="twitter:description"
content="2003 年至現今台灣各地登革熱狀況統計分析。"
/>
<meta
name="twitter:image"
content="https://emma2334.github.io/dengue_tw/og.png"
/>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://d3js.org/topojson.v1.min.js"></script>
<link rel="stylesheet" href="./css/main.css" />
</head>
<body>
<div class="container">
<svg id="map">
<g class="city"></g>
<g class="town"></g>
</svg>
<div class="content">
<div id="overview">
<select id="year"></select>
<span class="area">台灣</span>共發現 <span class="total">0</span
> 起登革熱感染
</div>
<div id="month">
<h2>發病月份統計</h2>
<svg></svg>
</div>
<div id="age">
<h2>年齡層統計</h2>
<svg></svg>
</div>
<div id="abroad">
<h2>境外感染比例</h2>
<svg></svg>
</div>
</div>
</div>
<nav>
<span class="root">台灣</span>
<span class="city"></span>
<span class="town"></span>
</nav>
<div class="mask">
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div>
<div id="tooltip" class="hidden"></div>
<script type="module">
import createMap from './js/main.js'
;(function () {
const map = new createMap({
url: 'https://emma-proxy.vercel.app/api/eic/Age_County_Gender_061.json',
ready: () => {
const mask = document.querySelector('.mask')
mask.style.opacity = 0
mask.addEventListener('transitionend', () => mask.remove())
},
})
// Change year
document.getElementById('year').onchange = e => {
map.update({ year: e.target.value })
}
// Navbar event
document.querySelector('nav .root').onclick = map.reset.bind(map)
document.querySelector('nav .city').onclick = e => {
map.update({ area: e.target.innerText })
document.querySelector('nav .town').innerText = ''
}
})()
</script>
</body>
</html>