Question: Dears, Please advice how to call the below code //call and setup is at the end of TableauViz name value function var TableauViz = {
Dears,
Please advice how to call the below code
//call and setup is at the end of TableauViz name value function
var TableauViz = {
viz: '', //global object
workbook: '', //global object
activeSheet: '', //global object
vizUrl: '',
tableauVizContainer: 'tableauVizDiv',
initilize: function () {
if (TableauViz.vizUrl != '') {
TableauViz._getVizOnLoad();
}
},
_getVizOnLoad: function () {
//this will hold our viz
var vizDivObject = document.getElementById(TableauViz.tableauVizContainer);
var viz, workbook, activeSheet;
var options = {
width: vizDivObject.offsetWidth,
height: "700px", //vizDivObject.offsetHeight,
hideTabs: false,
hideToolbar: true,
onFirstInteractive: function () {
workbook = viz.getWorkbook();
activeSheet = workbook.getActiveSheet();
if (activeSheet.getSheetType() === 'dashboard') { //worksheet or dashboard
//this is dashboard, resize auto
activeSheet.changeSizeAsync({
behavior: tableauSoftware.SheetSizeBehavior.AUTOMATIC
});
}
//populate global objects to be used later
TableauViz.viz = viz;
TableauViz.workbook = workbook;
TableauViz.activeSheet = activeSheet;
}
};
viz = new tableauSoftware.Viz(vizDivObject, TableauViz.vizUrl, options);
}
};
//setup and call
TableauViz.vizUrl = '@Model.VizUrl'; //Assign viz url
$(document).ready(function () {
TableauViz.initilize();
});
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
