简体   繁体   English

尝试使用Javascript嵌入时,Tableau Workbook不会出现在网站中

[英]Tableau Workbook won't appear in website when trying to embed with Javascript

So I've been able to successfully embed a workbook hosted on Tableau Server using the html embed code. 因此,我已经能够使用html嵌入代码成功嵌入Tableau Server上托管的工作簿。 I now want some more flexibility with which reports I'm displaying to certain users of the website so I'm moving to the Javascript API. 我现在想要更大的灵活性,以便向网站的某些用户显示报告,因此我转向Javascript API。 Unfortunately the workbook now isn't loading. 不幸的是,该工作簿现在没有加载。

I'm following the Basic Embed tutorial on Tableau's website: https://onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.html 我正在关注Tableau网站上的基本嵌入教程: https : //onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.html

Here's my code: 这是我的代码:

function initViz() {
        var placeholderDiv = document.getElementById('tableauPlaceholder');
        var url = 'https://#########.#######.###/views/EnrollmentTool/EnrollmentChange'   
        var options = {
            hideTabs: true,
                    onFirstInteractive: function () {
                        console.log("Run this code when the viz has finished loading.");
                    }
        };
        var viz = new tableau.Viz(placeholderDiv, url, options);
    }

The onFirstInteractive log statement doesn't get called, so it seems that the viz isn't actually loading. 由于未调用onFirstInteractive日志语句,因此似乎未真正加载viz。

I discovered the issue, the API version I was importing into my HTML file was viz_v1.js. 我发现了这个问题,我导入HTML文件的API版本是viz_v1.js。

I had to use tableau-2.min.js instead. 我不得不改用tableau-2.min.js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM