11 Replies Latest reply on Mar 1, 2017 2:06 PM by jeff weiss

    Can anyone help me with Javascript API embed from Tableau Server? (Tableau Desktop 10.1.4)

    jeff weiss

      We currently have Tableau Desktop 10.1.4, and a running Tableau Server with 10 connector licenses.  We have a public (.Net) site with a few Tableau visualizations  embedded on some of the pages using the Tableau JavaScript API.  The Tableau worksheets are published to Tableau Public for the public website. We need to use the Tableau JavaScript API to keep the site's UI constant.  We are now working on two more sites that will go public in the future. Because we do not want the possibility of the public finding the data before the sites are release ready, we want publish the Tableau worksheets our on-prem Tableau Server during development QA time. We will publish them to to Tableau Public when the sites are ready for production. I know that the  JavaScript API for Tableau Public is different from Tableau Server. The problem:  I have no trouble embedding the visualizations from Tableau Public, but I can not  get them to display  from our local Tableau Server.  Here is sample code for both cases.  Maybe you can help me figure out what I am doing wrong with publishing to our local Tableau Public

       

      USING JAVASCRIPT API TO EMBED VISUALIZATIONS INTO WEB PAGES FROM TABLEAU PUBLIC (works ok):

      VizRepository:  https://public.tableau.com/profile/ia.department.of.education#!/

      <div id="vizPlace" ></div>

      <script type="text/javascript">

          var viz, workbook, activeSheet, vizURL;

          var vizDiv = document.getElementById('vizPlace');

          var vizOptions = {

              hideTabs: true,

              onFirstInteractive: function () {

                  workbook = viz.getWorkbook();

                  activeSheet = workbook.getActiveSheet();

              }

          };

             vizURL = 'http://tableau-taging.ed.iowa.gov/views/Enrollment2/EnrollmentByDistrict'

             viz = new tableau.Viz(vizDiv, vizURL, vizOptions);

      </script>

       

      USING JAVASCRIPT API TO EMBED VISUALIZATIONS INTO WEB PAGES FROM TABLEAU SERVER (does not work):

      VizRepository:  https://tableau-staging.ed.iowa.gov/#/views/Enrollment2/EnrollmentByDistrict?:iid=1

      Link Code: http://tableau-staging.ed.iowa.gov/views/Enrollment2/EnrollmentByDistrict?:embed=y&:showShareOptions=true&:display_count=no &:showVizHome=no

      <script type='text/javascript' src='https://tableau-staging.ed.iowa.gov/javascripts/api/viz_v1.js'></script>

      <div class="row">

          <div class='tableauPlaceholder' id='tableauPlaceholder' style="width:1100px;height:660px;">

              <object class='tableauPlaceholder' style="width:1100px; height:600px">

      <param name='host_url' value='htpps://tableau-staging.ed.iowa.gov/' />

      <param name='site_root' value='/t/' />

      <param name='name' value='Enrollment2/EnrollmentByDistrict/' />

      <param name='tabs' value='no' />

      <param name='toolbar' value='yes' />

      </object>

          </div>

      </div>