Tableau Java Script API Call


This is the Web page Calling Tableau Worksheet Using Java Script API.

This is the Web page Calling Tableau Worksheet Using Java Script API.

Here it’s a simple call through Java Script API ( Details below ) . We build up on this and in the next blog we have added all interaction between webpage and the tableau dashboard – the beauty of Tableau Java Script API .

Here is the Link – https://technicaljockey.com/tableau-server-training/tableau-dashboard-web-page-interactions/

A script is program code that doesn’t need pre-processing (e.g. compiling) before being run. In the context of a Web browser, scripting usually refers to program code written in JavaScript that is
executed by the browser when a page is downloaded, or in response to an event triggered by the user. In the Head section above , we have two script Tags. The first script tag accesses the Tableau
Java Script API that resides on Tableau Server / Public / Online. The Second script tag has details of the Tableau Visualization and loads it when the HTML page runs.

If you see in the source code of this content,there is a piece of code below within the div tag that allows you to place your Visualization anywhere you want in the body . So This is the Content
that we have written before calling the Tableau Viz . Also the below Tag can be used to resize .

This is the content that we have after the Viz . So this shows that we can place our Visualization where we want to using .

So to summarize , In this web Page we are calling the Tableau Visualization through Java Script API.

There are two things that you need to Note here . Also do not forget to load the java script function while loading the body . See the start of the body tag that has onload= initViz() that calls
the init Viz function to execute the code when the page runs.

1. You need to get the Java Script API File from the Tableau Server / Tableau Online / Tableau Public . This varies based on your Tableau Server version. so the First Script Tag has the location and
calls the Tableau Java Script API from the Server.

2. The second Script has the details about the Tableau Workbook that you want to display on your webpage. The earlier example on this website shows you how to display the Tableau Workbook from
server by Embedding it .

This example is different from it in the context that we are not embedding it , rather we are calling it through Java Script API . The moment we call it through Java Script API, we get “n” number of
features that we can use which means now we can create “Buttons” on web page and when we click the button on the web page , it would interact with the Tableau Workbook / Dashboard and do the
necessary action like Filtering or moving to next Viz or Displaying Marks and so .
This presents a wonderful opportunity wherein we can have dynamic content on our web page and the Tableau Dashboard can be working based on the Dynamic content that gets updated on a daily basis for
e.g. Say our website page is designed to Dispaly the Top 5 best performing IPO’s and the Tableau Viz that has all the details about the like its growth rate or how it has been trending ,can then be
dynamically called and located on the web page.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top