Published
Edited
Jul 14, 2020
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viz = {
let oldViz = window.tableau.VizManager.getVizs()[0];
if (oldViz) {
mutable vizLoaded = 0
oldViz.dispose();
}
yield new tableau.Viz(placeholderDiv, url, options);
}
Insert cell
workbook =
{
if (vizLoaded == 1) {
yield viz.getWorkbook();
}
}
Insert cell
Insert cell
Insert cell
timer =
{
let i=1800; //First year in the dataset
while (vizLoaded == 1)
{
await Promises.delay(1000);
yield filterViz(i>2018? i=1800:(i>=1900? i++:i+=10)); //We loop through every 10 years from 1800 to 1900
}
}
Insert cell
filterViz = (year)=>{
workbook.activateSheetAsync("The Wealth and Health of Nations")
.then(function (newSheet) {
const activeSheet = newSheet;
return activeSheet.getWorksheets().get("YearLabel").applyFilterAsync(
"Year",
year.toString(),
tableau.FilterUpdateType.REPLACE);
});
}
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