Tableu With Javascript API and UI
Tableu With Javascript API and UI
With Tableau's JavaScript API you can integrate Tableau visualizations into your own web
applications. The API lets you tightly control your users' interactions and combine functionality that
otherwise couldn't be combined. For example, you can code a single control that filters a group of
marks, selects some of those marks, and presents their data for download.
Here are some of the things that you can do with the JavaScript API:
Display visualizations from Tableau Server, Tableau Public, and Tableau Online in web
pages.
Filter the data displayed in visualizations with HTML controls in the page.
Get Started
1
Create a web page and include the JavaScript API file from the Tableau Server that
hosts your visualizations:
<script src="https://YOUR-SERVER/javascripts/api/tableau-2.js"></script>
Create a div element in the page body where you want to insert the Tableau
visualization:
<div id="vizContainer"></div>
2
3
4
5
function initViz() {
var containerDiv = document.getElementById("vizContainer"),
url = "http://YOUR-SERVER/views/YOUR-VISUALIZATION";
Display visualizations from Tableau server , Tableau public and Tableau online into the web
pages
Dimensions : While passing dimension filters ,just list each value by separating them with a
comma. If you want to pass multiple dimension filters separate them with an ampersand. For
example,
Measures : Measures can be filtered same as the above method by passing distinct
values.However , tableau does not support using greater than or less than logic.
Date/Time : To filter date or time field , time component can be regarded as optional . For
instance,
Date field=yyyy-mm-dd
hh:mm:ss (optional)
Character Limits:
Although there is no limit on number of parameter values to pass on an embedded view , there might
be an URL length restriction imposed by the end users browser.
HTTP Protocol does not impose any limit on URL length as you can notice many modern day
browsers can handle URL length up to 80,000 characters , however internet explorer 8 & 9 have a
maximum character limit of 2,083 characters only.
Therefore, you should be conscious of keeping URLs under this limit to assure compatibility. Note
that the complete URL length does not mean to definitely include passed parameters and resulting
values from it.
Username
Client_ip
The web server receives unique_id through the form which is further used in the embedded views
URL , as shown:
HTTPS://YOURTABLEAUSERVER.COM/TRUSTED/UNIQUE_ID/T/VIEWS/MYWORKBOO
K/MYDASHBOARD?:EMBED=YES
If you are using java script, <param>tag can be used as:
<param name=ticket
Value=unique_id/>
Once if unique_id is issued , it must be reclaimed within 15 seconds from a machine matching the
client_ip specified ,or else it would become invalid. As soon as tableau server receives the request
that the user has logged in , then trusted ticket URL is resolved to that of a standard request.
Even before web server can make a request of trusted ticket authentication,it must first be on trusted
listof tableau server. This can be achieved using tabadmin command where xxx.xxx.xxx.xxx
indicates an IP address for every trusted web server.
Tabadmin set wgserver.trusted_hosts xxx.xxx.xxx.xxx , xxx.xxx.xxx.xxx.