Public
Edited
Feb 11
Importers
2 stars
Insert cell
Insert cell
viewof selected = TimeWidget(unemployment, {
showBrushesControls: true,
y: "unemployment",
x: (d) => d.date,
id: (d) => d.division,
// color: d=> d.division.split(",")[0]
})
Insert cell
Inputs.table(selected.asArray())
Insert cell
(viewof selected).brushesCoordinates
Insert cell
unemployment
Insert cell
Insert cell
selected.status
Insert cell
fmtY = d3.format(".2f")
Insert cell
fmtX = d3.timeFormat("%d/%m/%y")
Insert cell
Generators.observe(notify => {
viewof selected.ts.statusCallback((data) => notify(data))
})
Insert cell
(viewof selected.ts).statusCallback
Insert cell
{
selected;
return selected.brushes
}
Insert cell
selected.brushes
Insert cell
// viewof selected2 = TimeSearcher({
// data: stocks.filter(d => d.stock !== "NVR"),
// y: d => d.price,
// x: d => d.Date,
// id: d => d.stock
// })
Insert cell
Inputs.table(unemployment)
Insert cell
unemployment = FileAttachment("bls-metro-unemployment.csv").csv({typed: true})
Insert cell
// import {data as stocks} from "@ivelascog/timesearcher-npm"
Insert cell
TimeWidget = {
try {
console.log("Trying to load timesearcher local")
return await require(`http://localhost:8080/dist/TimeWidget.js?${Date.now()}`);
} catch (e) {
try {
console.log("Failed. Trying to load timesearcher from a File Attachment");
return await require(await FileAttachment("TimeWidget@2.js").url());
} catch (e2) {
console.log("Failed. Trying to load timesearcher from NPM");
return await require("time-widget");
}
}
}
Insert cell
TimeSearcher = TimeWidget
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