3 Replies Latest reply on Mar 25, 2018 2:29 PM by nataraj.vijayanagaram

    Dashboard Selection using API

    nataraj.vijayanagaram

      Hello All,

       

      I am trying to use the javascript api to change dashboard selection / view.

       

      I have below code but it is not working..function - switchToMapTab.. Can someone please advise..

       

      <!DOCTYPE html>

      <html>

       

       

      <head>

          <title>Basic Embed</title>

        

          <script type="text/javascript"

              src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>

          <script type="text/javascript">

              function initViz() {

                  var containerDiv = document.getElementById("vizContainer"),

                      url = "http://public.tableau.com/views/WorldIndicators/GDPpercapita",

                      options = {

                          hideTabs: true,

                      

                      };

                

                  var viz = new tableau.Viz(containerDiv, url, options);

                  // Create a viz object and embed it in the container div.

              }

       

       

              function switchToMapTab() {

        workbook.activateSheetAsync("GDP per capita map");

      }

       

       

      function selectSingleValue() {

        workbook.getActiveSheet().selectMarksAsync(

          "Region",

          "Asia",

          tableau.SelectionUpdateType.REPLACE);

      }

       

       

          </script>

      </head>

       

       

      <body onload="initViz();">

          <a href="#" onClick="selectSingleValue();">selectSingleValue</a><br>

          <a href="#" onClick="switchToMapTab();">switchToMapTab</a><br>

       

       

          <div id="vizContainer" style="width:800px; height:700px;"></div>  

      </body>

       

       

      </html>