-
Notifications
You must be signed in to change notification settings - Fork 106
/
index.html
172 lines (129 loc) · 8.26 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Covid Trends</title>
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="style.css?2">
<script src="libraries/plotly-basic.min.js"></script>
<script src="libraries/vue.min.js"></script>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Covid Trends">
<meta name="twitter:description" content="Visualizing the exponential growth of COVID-19 across the world.">
<meta name="twitter:site" content="@aatishb">
<!-- Twitter Summary card images must be at least 120x120px -->
<meta name="twitter:image" content="https://aatishb.com/covidtrends/logos/covid-trends-logo-nowords.png">
<!-- Open Graph data -->
<meta property="og:title" content="Covid Trends" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://aatishb.com/covidtrends/" />
<meta property="og:image" content="https://aatishb.com/covidtrends/logos/covid-trends-logo-nowords.png" />
<meta property="og:description" content="Visualizing the exponential growth of COVID-19 across the world." />
</head>
<body>
<div id="root">
<header>
<div class="explainer">
<p>This interactive charts the <b><i>new</i></b> {{selectedData.toLowerCase()}} of COVID-19 in the past week vs. the <b><i>total</i></b> {{selectedData.toLowerCase()}} to date. When plotted in this way, exponential growth is represented as a straight line that slopes upwards. Notice that almost all countries follow a very similar path of exponential growth. <i>We're all in this together.</i> <span v-if="isHidden"><a @click="toggleHide">Learn more.</a></span></p>
<span v-if="!isHidden">
<p>To learn more about this graph, watch this video created by Minute Physics.</p>
<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/54XLXg4fYsc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p><i><b>Note:</b> The x-axis of this graph is not time</i>, but is instead the total number of cases or deaths.</p>
<p><b>Tips:</b> Press Space (or the play button) to Play/Pause. Press +/- keys (or drag the slider) to see daily changes. Hover over the graph for more info. Drag your mouse to zoom in, doubleclick to zoom back out. And don't forget to wash your hands!</p>
<a id="hide" @click="toggleHide">Hide</a>
</span>
</div>
<div class="logowrapper">
<h1><a href="https://aatishb.com/covidtrends">Covid Trends</a></h1>
<div v-if="!isHidden" class="logos">
<a href="https://aatishb.com/" aria-label="Visit the website of Aatish Bhatia"><img src="logos/aatishb-bw.png" height="40" alt="Avatar of Aatish Bhatia"></a>
<a href="https://www.youtube.com/user/minutephysics" aria-label="Visit the Youtube channel of Minute Physics"><img src="logos/minutephysics-invert.png" height="40" alt="Minute Physics Logo"></a>
</div>
</div>
</header>
<div class="ctapp">
<main id="main">
<graph v-if="covidData.length > 0 && countries.some(country => selectedCountries.includes(country))" :graph-data="graphData" :day="day" :resize="isHidden" v-bind.sync="graphAttributes"></graph>
<div v-if="covidData.length > 0 && countries.some(country => selectedCountries.includes(country))" class="nav">
<div class="navelement">
<img v-show="paused" @click="play" src="icons/play.svg" alt="Play" style="width: 3rem;">
<img v-show="!paused" @click="play" src="icons/pause.svg" alt="Pause" style="width: 3rem;">
</div>
<div class="navelement">
<time class="h2" :datetime="formatDate(minDay > 0 ? dates[day - 1] : dates[dates.length - 1])">{{ formatDate(minDay > 0 ? dates[day - 1] : dates[dates.length - 1]) }}</time>
</div>
<div class="navelement slidercontainer">
<input v-if="dates.length > 7" type="range" :min="minDay > 0 ? minDay : dates.length" :max="dates.length" step="1" v-model="day" class="slider" @mousedown="pause" aria-label="Choose the current observation day">
</div>
<div class="navelement">
<select @change="createURL" v-model="selectedScale" @mousedown="pause" aria-Label="Select Scale">
<option v-for="s in scale" v-bind:value="s">
{{ s }}
</option>
</select>
</div>
</div>
<div v-if="!firstLoad && covidData.length == 0" class="nodata"><span>Not enough data for these parameters.</span></div>
<div v-if="!firstLoad && covidData.length != 0 && !countries.some(country => selectedCountries.includes(country))" class="nodata"><span>Please select some {{regionType.toLowerCase()}} to display.</span></div>
<footer>
Created by <a href="https://aatishb.com/">Aatish Bhatia</a> in collaboration with <a href="https://www.youtube.com/user/minutephysics">Minute Physics</a> · World data provided by <a href="https://github.com/CSSEGISandData/COVID-19">Johns Hopkins University</a> (updated daily around 00:00 UTC / 20:00 ET) · US state data provided by <a href="https://github.com/nytimes/covid-19-data">NYTimes</a> (updated daily around 16:00 UTC / 12:00 ET)· Shortcuts: +/- for daily changes, space to play/pause · <a href="https://github.com/aatishb/covidtrends#credits">Credits & Source</a> · <a href="https://www.cdc.gov/coronavirus/2019-ncov/prepare/prevention.html">Stay safe!</a>
</footer>
</main>
<aside>
<div>
<h2>Customize</h2>
<label for="selectedData">Select Parameter</label>
<select id="selectedData" v-model="selectedData" @mousedown="pause">
<option v-for="d in dataTypes" v-bind:value="d">
{{ d }}
</option>
</select>
<label for="selectedRegion">Select Region</label>
<select id="selectedRegion" v-model="selectedRegion" @mousedown="pause">
<option v-for="s in regions" v-bind:value="s">
{{ s }}
</option>
</select>
<label for="selectedScale">Select Scale</label>
<select @change="createURL" id="selectedScale" v-model="selectedScale" @mousedown="pause">
<option v-for="s in scale" v-bind:value="s">
{{ s }}
</option>
</select>
<input type="checkbox" style="margin-top: 0.75rem;" id="showLabels" v-model="showLabels">
<label for="showLabels">Show Labels</label>
<div>
<input @change="createURL" type="checkbox" style="margin-top: 0.75rem;" id="showTrendLine" v-model="showTrendLine">
<label for="showTrendLine">Show
<input @change="createURL" type="number" min="1" step="1" style="width: 3rem; padding: 0rem; font-size: inherit;" v-model.number="doublingTime" @focus="pause" aria-label="Doubling Time in Days">
Day Doubling Time</label>
</div>
</div>
<div class="countries">
<h2>{{regionType}}</h2>
<div class="search">
<input id="searchField" v-model="searchField" placeholder="Search For A Location" aria-label="Search For A Location">
</div>
<div class="buttonwrapper">
<button @click="deselectAll" aria-Label="Deselect All Regions">Deselect All</button>
<button @click="selectAll" aria-Label="Select All Regions">Select All</button>
</div>
<p style="padding-top: 1rem;">Showing {{regionType}} with at least {{minCasesInCountry}} {{selectedData}}</p>
<ul>
<li v-for="country in visibleCountries">
<input @change="createURL" type="checkbox" :id="country" :value="country" v-model="selectedCountries">
<label :for="country">{{country}}</label>
</li>
</ul>
</div>
</aside>
</div>
</div>
<!-- page code -->
<script src="vue-definitions.js?7"></script>
</body>
</html>