3 Replies Latest reply on Nov 12, 2019 6:20 AM by Vineeth Nair

    React/ JS API Viz Issue

    Ben  Hazzard



      I'm trying to implement a dashboard from Tableau public into my project, but I'm having an issue calling the Viz constructor.

      Page Component:

      Screen Shot 2018-12-29 at 5.24.48 PM.png

      Viz Component:

      Screen Shot 2018-12-29 at 5.24.32 PM.png



      Screen Shot 2018-12-29 at 5.26.02 PM.png


      I have also included a .d.ts file in the tableau-api directory to declare both of the files.



        • 1. Re: React/ JS API Viz Issue

          Hello Ben,


          Thanks for posting in the Tableau Community. I have not been able to find any information on the error that is returned.


          I might consider also trying to post on the Tableau GitHub page regarding the error if you are able to reproduce it with a sample.


          Issues · tableau/js-api-samples · GitHub


          My comment will also bring this post back to the top of the feed. Hope this helps!



          Byrne, Patrick

          Community Manager

          Tableau Software

          • 2. Re: React/ JS API Viz Issue
            John Hegele

            Hey Ben,


            I hope that you got this sorted out since I'm about 6 months late to this questions. But I stumbled across this searching for something else so wanted to chime in.


            I'm pretty sure that the issue you're hitting here is that the way you're instantiating the Viz class is invalid. You are using:


            var viz = new tableau.Viz(url)


            The constructor for the Viz class requires three arguments: domNode, url, and options (see API Reference - Tableau ) and you are only passing one. You need to provide a value DOM node where the viz will be rendered, the URL of the viz itself, and any options you want to apply to the viz.



            1 of 1 people found this helpful
            • 3. Re: React/ JS API Viz Issue
              Vineeth Nair

              Hi Ben,


              This is a really delayed reply but I came across this when trying to sort out a similar issue. If you have not already tried it then try changing

              var viz = new tableau.Viz(url) to var viz = new window.tableau.Viz(<domNode>, url, <options>)

              To find out what domNode and options are John has provided the best reference in the post above.