Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed Tableau into a web page using the tableau JavaScript API?

I'm a beginner trying to embed Tableau visualization into my web page, such that whenever the link is clicked, visualization is rendered on the page. But the browser loads with an error on the tableauSoftware object. How can I initialize this object?

I'm using the Tableau server trial version

<html>
    <head>
        <script type='text/javascript' src='http://localhost:85/javascripts/api/viz_v1.js'></script>
        <script>
            function initializeViz() {
                var placeholderDiv = document.getElementById("tableauViz");
                var url2 = "http://localhost:85/views/test_page/Sheet1?:embed=y&:display_count=no";
                viz = new tableauSoftware.Viz(placeholderDiv, url2);
            }
        </script>
    </head>

    <body>
        <a href="#" onclick="$('#tableauViz').html(''); initializeViz()">visualize</a>

        <div class id ="tableauViz"></div>
    </body>
</html>

I get this error:

Enter image description here

like image 574
ArchieTiger Avatar asked Jan 11 '14 23:01

ArchieTiger


People also ask

How do I embed a Tableau into a web portal?

Get the embed code provided with a view: Click the Share button at the top of a view. (The Share button doesn't appear in embedded views if you change the showShareOptions parameter to false in the code.) Click Copy Embed Code, then paste the code into your webpage.

Can you embed Tableau Public in website?

You can publish your dashboard to Tableau Public and email users the link to the visualization in Tableau Public. You can publish your dashboard to Tableau Public and then embed the dashboard in a website. This method allows users to view the visualizations in their own website without having to go to Tableau Public.

Does Tableau support JavaScript?

Use the Tableau JavaScript API to integrate Tableau visualizations into your own web applications. 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.

How do I embed tableau data into a website?

Click Copy Embed Code, then paste the code into your webpage. Customize the embed code: You can customize the embed code using parameters that control the toolbar, tabs, and more. For more information, see Parameters for Embed Code. Use the Tableau JavaScript API: Web developers can use Tableau JavaScript objects in web applications.

How do I use the tableau JavaScript API?

You can use the Tableau JavaScript API to embed and integrate Tableau visualizations into your own web applications. You can display visualizations from Tableau Server, Tableau Public, and Tableau Online and programmatically interact with individual views. Using the Tableau JavaScript library, you can:

How do I integrate tableau visualizations into a web application?

You can use the Tableau JavaScript API to embed and integrate Tableau visualizations into your own web applications. You can display visualizations from Tableau Server, Tableau Public, and Tableau Online and programmatically interact with individual views.

What is the tableau embedding API v3?

The Tableau Embedding API v3 provides the latest iteration of embedding capabilities for the front-end of your application. It features a modern approach to initializing embedded content using web components.


1 Answers

I don't have my laptop to hand to confirm which script should be used on a local Tableau Server installation, but try the Tableau Public script (as per the JavaScript API Tutorial) and see if there's any change:

<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>  

Having now checked my own local Tableau Server installation, the script you need is this one:

<script type="text/javascript" src="http://localhost:85/javascripts/api/tableau_v8.js"></script>
like image 142
Talvalin Avatar answered Oct 13 '22 01:10

Talvalin