2 Replies Latest reply on Jun 13, 2018 4:45 AM by rajanna ap

    Javascript API example

    seenuvasan manoharan

      Hi All,


      I would like to know the example code that how to use javascript API to render our tableau view.


      i referred below url, JavaScript API Tutorial in 1st create step, but it never render view into my page. could you please suggest me if am missing any thing here


      i am doing following

      1. created div in my html <div class='tableauPlaceholder'></div>

      2. in javascript code i am calling url


      function initializeViz() {

        var placeholderDiv = document.getElementById("tableauPlaceholder");

        var url = "http://public.tableausoftware.com/views/WorldIndicators/GDPpercapita"; // i tried with my published tableau url here

        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);


      3. adding this script tag in "head" tag of html <script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>

      4. i am calling this javascript function on click of button