Published
Edited
Jul 13, 2021
Insert cell
Insert cell
Insert cell
Insert cell
margin = ({
top: 50,
right: 10,
bottom: 10,
left: 50
})
Insert cell
Insert cell
Insert cell
raw_data = d3.csv(
"https://www3.nhk.or.jp/n-data/opendata/coronavirus/nhk_news_covid19_prefectures_daily_data.csv",
d3.autoType
)
Insert cell
maxCase = d3.max(
[...dataByPref.values()].flat(),
(d) => d.各地の感染者数_1日ごとの発表数
)
Insert cell
data.filter((d) => dates.includes(d.date))
Insert cell
Insert cell
Inputs.table(raw_data)
Insert cell
Insert cell
data = raw_data.map((d) => ({
date: new Date(d.日付),
...d
}))
Insert cell
Insert cell
dataByPref = new Map(
[...d3.group(data, (d) => d.都道府県名).entries()].map(([key, values]) => [
key,
values.slice(-100)
])
)
Insert cell
prefs = [...dataByPref.keys()]
Insert cell
dates = dataByPref.get(prefs[0]).map((d) => d.date)
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more