Published
Edited
Mar 23, 2019
3 forks
11 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

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