Published
Edited
Nov 28, 2021
1 fork
Importers
Insert cell
Insert cell
mySelect
Insert cell
import {covidStats, complexInputValues, select} from "@quackas/wip"
Insert cell
Insert cell
/*viewof chartShows = radio({
title: 'Covid-19 national count shows the following:',
options: [
{ label: 'Number confirmed', value: 'numconf' },
{ label: 'Rate confirmed', value: 'rateconf'},
{ label: 'Deaths confirmed', value: 'deathsconf' },
{ label: 'Death Rate confirmed', value: 'deathrate'},
{ label: 'Number Tests', value: 'numtests'},
{ label: 'Number today', value: 'numtoday' },
{ label: 'Rate recovered', value: 'raterecovered'}
],
value: 'numconf'
})*/
Insert cell
Insert cell
mySelect.key
Insert cell
Insert cell
/*viewof all_together_now = {
let div = d3
.create("div")
.style("position", "relative")
.style("height", "500px");

let legend = div
.append("div")
.style("position", "absolute")
.style("top", "0px")
.style("left", "750px");
legend.append(() => viewof selections);

let chart = div
.append("div")
.style("width", "700px")
.style("position", "absolute")
.style("top", "0px")
.style("left", "0px");
if(mySelect.key == "numconf"){
chart.append(() => viewof chart2);
}
else if(mySelect.key == "numtoday"){
chart.append(() => viewof numtoday);
}
else if(mySelect.key == "rateconf"){
chart.append(() => viewof numrate);
}
else if(mySelect.key == "numdeaths"){
chart.append(() => viewof numdeaths);
}
else if(mySelect.key == "deathrate"){
chart.append(() => viewof deathrate);
}
else if(mySelect.key == "numtests"){
chart.append(() => viewof numtests);
}
else if(mySelect.key == "raterecovered"){
chart.append(() => viewof raterecovered);
}

return div.node();
}*/
Insert cell
Insert cell
Insert cell
Insert cell
data2 = d3.group(data1, d => d.prname)
Insert cell
Insert cell
popLookup = new Map(popu.map(d=>[d.prname, d.pop]))
Insert cell
popLookup.get("Canada")
Insert cell
Insert cell
data3 = data4.filter(d => (!d.prname.includes("Repatriated travellers")))
Insert cell
result = data1.map(v => ({ ...v, ...popu.find(d => d.prname === v.prname) }));

Insert cell
visWidth = 800
Insert cell
visHeight = 800
Insert cell
Insert cell
Insert cell
Insert cell
y = d3.scaleLinear()
.domain([0, mutdomain(mySelect.key)]).nice()
.range([visHeight, 0])
Insert cell
d3.extent(data3, d => d.date)
Insert cell
a2021 = [new Date("2020-01-31"), new Date("2021-01-01")]
Insert cell
a2022 = [new Date("2021-01-01"), new Date("2021-10-01")]
Insert cell
Insert cell
Insert cell
Insert cell
import {Wrangler, op, dataInput} from "@observablehq/data-wrangler"
Insert cell
Insert cell
Insert cell
colors = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf", "#00ff00", "#333333", "#e511ca", "#6699d8", "#b6fcd5"]
Insert cell
Insert cell
import {radio} from "@jashkenas/inputs"
Insert cell
Insert cell
Insert cell
Insert cell
mySelect.key
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
color = carColor
Insert cell
last = array => array[array.length - 1]
Insert cell
colorScale = d3.scaleOrdinal(
[...new Set(data3.map((d) => d.prname))],
d3.schemeTableau10
)
Insert cell
viewof voronoi = Inputs.toggle({label: "Show voronoi"})
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