Published
Edited
Apr 10, 2019
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
workbook.getParametersAsync().then(
function(params) {
return params.get("Parameter").getAllowableValues()[0].formattedValue
})
Insert cell
list=workbook.getParametersAsync().then(
function(params) {
var Parameter= params.get("Parameter");
var allValues=[];
var pas;
for (pas = 0; pas < Parameter.getAllowableValues().length; pas++) {
var str = Parameter.getAllowableValues()[pas].formattedValue;
allValues.push(str);
}
return allValues;
}
)
Insert cell
Insert cell
Insert cell
Insert cell
timer =
{
let i=0; //First year in the dataset
while (vizLoaded == 1)
{
await Promises.delay(3000);
yield filterViz(i > list.length? i=0:i+=1); //We loop through every value in Parameter
}
}
Insert cell
filterViz = (Frame)=>{
workbook.changeParameterValueAsync("Parameter",list[Frame])
;
}
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