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

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