11 Replies Latest reply on Aug 21, 2015 8:36 AM by Matt Lutton

    Beginner JS API - Why Can't I Instantiate Viz?

    Matt Lutton

      I started to try and walk through the API tutorial (JavaScript API Tutorial), and constructed a simple webpage as follows, but no viz is being loaded.  What am I missing here?  I have dabbled in JS a bit, but its been a while.

       

      <html>
      <head>
      <title>API Example Tutorial</title>


      </head>
      <body>
      HELLO
            <p class="runCode">
              <button onclick="initializeViz()">Run this code</button>
            </p>

      <script type="text/javascript">

      function initializeViz()
      {
        var placeholderDiv = document.getElementById("tableauViz");
        var url = "http://public.tableausoftware.com/views/WorldIndicators/GDPpercapita";
        var options = {
          width: placeholderDiv.offsetWidth,
          height: placeholderDiv.offsetHeight,
          hideTabs: true,
          hideToolbar: true,
          onFirstInteractive: function () {
            workbook = viz.getWorkbook();
            activeSheet = workbook.getActiveSheet();
          }
        };
        viz = new tableauSoftware.Viz(placeholderDiv, url, options);
      }  

      </script>

      </body>
      </html>