Published
Edited
May 16, 2020
2 forks
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { data as data3 } from "@neelance/the-new-york-times-covid-19"
Insert cell
Insert cell
import { data as data4 } from "@neelance/rki-covid-19-in-germany"
Insert cell
Insert cell
viewof dataSource = select({
options: [
"Johns Hopkins CSSE (Global)",
"Our World in Data (Global)",
"Johns Hopkins CSSE (US)",
"The New York Times (US)",
"Robert Koch Institute (Germany)",
],
value: "Johns Hopkins CSSE (Global)",
description: "data source"
})
Insert cell
data = ({
"Johns Hopkins CSSE (Global)": data1Global,
"Our World in Data (Global)": data2,
"Johns Hopkins CSSE (US)": data1US,
"The New York Times (US)": data3,
"Robert Koch Institute (Germany)": data4,
})[dataSource]
Insert cell
viewof axisY = select({
options: ["confirmed", "deaths"],
value: "confirmed",
description: "Y dimension"
})
Insert cell
viewof axisX = select({
options: ["date", "confirmed", "deaths"],
value: "date",
description: "X dimension"
})
Insert cell
viewof numberOfRegions = slider({
min: 10,
max: 30,
value: 10,
step: 1,
description: "number of regions"
})
Insert cell
viewof useLog = checkbox({
options: ["Use logarithmic scales"],
value: ["Use logarithmic scales"]
})
Insert cell
viewof useRegression = checkbox({
options: ["Trend lines"],
value: []
})
Insert cell
viewof regressionPeriod = slider({
min: 3,
max: 20,
value: 0,
step: 1,
description: "number of days past"
})
Insert cell
viewof regressionDelay = slider({
min: 0,
max: 20,
value: 0,
step: 1,
description: "delay"
})
Insert cell
Insert cell
parseDate = d3.timeParse("%Y-%m-%d")
Insert cell
d3 = require("d3@5", "d3-array@2", "d3-delaunay@5", "d3-regression")
Insert cell
import { checkbox, select, slider } from "@jashkenas/inputs"
Insert cell
import { occlusion } with { d3 } from "@fil/occlusion"
Insert cell
html`<style>
svg.chart { overflow: visible }
svg.chart text.occluded { display: none; }
svg.chart text:not(.occluded) { text-shadow: 1px 1px 1px #fff; pointer-events: none; font-family: sans-serif; }
</style>`
Insert cell
import { callout } from "@d3/line-chart-with-tooltip"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more