6 Replies Latest reply on Sep 20, 2018 7:15 AM by Lukas Kulhanek

    JavaScript API - Viz Loading But Blank?

    Melanie Walsh

      So I'm using the Tableau JavaScript API for the first time and running into a bit of trouble.

       

      The code for the sample Tableau viz loads and works fine on my website. But when I use the URLs to my own visualizations, the Tableau viz will load but be blank inside. The content isn't there. But when I go fullscreen, the content suddenly appears and stays there even when I exit out of full screen. Does anyone have any idea what's going on or how I might be able to fix this problem? The code I'm using is below:

       

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

      <script>

              function initViz() {

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

                      url = "https://public.tableau.com/views/BlackLivesMatter-Baldwin-Top-Tweets/TypeofTweet",

                      options = {

                          hideTabs: true,

                          onFirstInteractive: function () {

                                console.log('loaded!');

                                workbook = viz.getWorkbook();

                                activeSheet = workbook.getActiveSheet();

                          }

                      };

       

       

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

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

              }

       

       

      </script>

       

       

      <body onload="initViz();">

        <div id="vizContainer"></div>

      </body>