vizyourdata
vizyourdata

Reputation: 1444

Tableau Full Screen View With JavaScript API

Is it possible to force tableau server or online to display the view in full screen when loading an embedded view? You can do this with one more step by clicking the Full Screen option in the menu items (img below). It would be great to have this as the default or be able to toggle with the API. Is that possible? Thanks! enter image description here

Upvotes: 1

Views: 5478

Answers (2)

Mike Longlais
Mike Longlais

Reputation: 31

There is an even easier way. The "Fullscreen" view is simply an iframe. If you look at the source of the iframe and navigate directly to that address then you get the fullscreen view.

Developer Mode

Upvotes: 3

Karthik Venkatraman
Karthik Venkatraman

Reputation: 1657

I dont think there is an api function to resize the view to full screen. however, you can use the below code to resize the tableau frame using javascript api.

function setFrameSize() {
    if (mainViz === null) {
        alertOrConsole("No Viz has been rendered");
        return;
    } else {
        mainViz.setFrameSize(900, 480);
    }
}

Also please let me know which version of tableau you are using.

Edit

You can use the fullscreen API as below

Create a javascript function for various browsers

var element = document.getElementById("divid");
// Find the right method, call on correct element
function launchIntoFullscreen(element) {
  if(element.requestFullscreen) {
    element.requestFullscreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.webkitRequestFullscreen) {
    element.webkitRequestFullscreen();
  } else if(element.msRequestFullscreen) {
    element.msRequestFullscreen();
  }
}

// Launch fullscreen for browsers that support it!
launchIntoFullscreen(document.documentElement); // the whole page
launchIntoFullscreen(document.getElementById("videoElement")); // any individual element

For exiting the fullscreen mode,

function exitFullscreen() {
  if(document.exitFullscreen) {
    document.exitFullscreen();
  } else if(document.mozCancelFullScreen) {
    document.mozCancelFullScreen();
  } else if(document.webkitExitFullscreen) {
    document.webkitExitFullscreen();
  }
}

// Cancel fullscreen for browsers that support it!
exitFullscreen();

Hope this might help you.

Upvotes: 2

Related Questions