-
Notifications
You must be signed in to change notification settings - Fork 24
/
forecast_chkans.html
105 lines (94 loc) · 2.96 KB
/
forecast_chkans.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
<!DOCTYPE html><html><head><meta charset="utf-8">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-162141832-1"></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag(){dataLayer.push(arguments)}
gtag('js', new Date())
gtag('config', 'UA-162141832-1')
</script>
<title>COVID-19 Japan 都道府県別 感染者予測と結果</title>
<style>
body {
font-family: sans-serif;
text-align: center;
}
h1 {
font-size: 4vw;
text-align: center;
}
h2 {
font-size: 2.5vw;
}
.src {
font-size: 85%;
}
</style>
</head>
<body>
<h1>COVID-19 Japan 都道府県別 感染者予測と結果</h1>
<select id=selpref></select>
<select id=seldate></select>
<script type="module" src="forecast-graph.mjs"></script>
<script type="module">
import { PREF, PREF_EN } from "./japan.js";
import { CSV } from "https://code4sabae.github.io/js/CSV.js";
window.onload = async () => {
const appendOptions = (sel, ar) => {
for (const d of ar) {
const opt = document.createElement("option");
opt.textContent = d;
sel.appendChild(opt);
}
};
const selectDate = (sel, days) => {
const viewd = new Date().getTime() - days * 24 * 60 * 60 * 1000;
for (const op of sel.children) {
const od = new Date(op.textContent).getTime();
console.log(op.textContent, od);
if (od > viewd) {
op.selected = true;
break;
}
}
};
const selectValue = (sel, val) => {
for (const op of sel.children) {
if (op.textContent == val) {
op.selected = true;
break;
}
}
};
const dates = await CSV.fetch("data/covid19forecast/google/list.csv");
dates.shift();
appendOptions(seldate, dates);
console.log(dates);
selectDate(seldate, 30);
appendOptions(selpref, PREF);
selectValue(selpref, "東京都");
seldate.onchange = selpref.onchange = () => {
const pref = PREF_EN[PREF.indexOf(selpref.value)];
main.innerHTML = `<forecast-graph view-src=true view-pref="${pref}" date="${seldate.value}"></forecast-graph>`;
};
if (document.location.hash.length > 1) {
selpref.value = PREF[PREF_EN.indexOf(document.location.hash.substring(1))];
}
selpref.onchange();
};
</script>
<div id="main">
<!--<forecast-graph view-src=true view-pref="Fukui" date="2020-11-15"></forecast-graph>-->
</div>
<div class=src>
App: <a href="https://fukuno.jig.jp/3050">「福井発、サイバーバレー始動!オープンデータで経済産業大臣賞受賞」 一日一創 by 福野泰介</a><br>
Data: <a href=https://github.com/code4sabae/covid19/tree/master/data/covid19forecast/google>Google社予測のデータ</a>(<a href=https://storage.googleapis.com/covid-external/COVID-19ForecastUserGuideJapan_Japanese.pdf>ユーザーガイド、利用規約</a>)<br>
</div>
<div style="margin:1em;text-align:center;">
<a href="https://www.stopcovid19.jp/">
<img src=img/stopcovid19_banner.png style="width:70vw"><br>
「COVID-19 JAPAN 新型コロナウイルス対策ダッシュボード」<br>
</a>
</div>
</body>
</html>