簡體   English   中英

當我將 Tableau 示例中的 URL 更改為另一個 URL 時,為什么我的代碼會中斷?

[英]Why does my code break when I change the URL in the Tableau sample to another URL?

當我將 Tableau 示例中的 URL 從https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.htm更改為以下 URL 時,為什么我的代碼會中斷? https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/Dashboard1

IE。 這有效:

  ```
<!DOCTYPE html>
<html>
<head>
 <title>Basic Embed</title>
 <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
 <script type="text/javascript">    
 function initViz(){var containerDiv = document.getElementById("vizContainer"),
 url = "http://public.tableau.com/views/RegionalSampleWorkbook/Storms",
 options = {hideTabs: true, onFirstInteractive: function(){console.log("Run this code when the
 viz has finished loading."); } }; var viz = new tableau.Viz(containerDiv, url, options);}
 </script>
</head>
<body onload="initViz();">
    <div id="vizContainer" style="width:800px; height:700px;"></div>
</body>
</html>
  ```

而這不會:

  ```
<!DOCTYPE html>
<html>
<head>
  <title>Basic Embed</title>
  <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
  <script type="text/javascript">
  function initViz() {var containerDiv = document.getElementById("vizContainer"),
  url ="https://public.tableau.com/profile/david.walls2745#!/vizhome/OlderWorkers_15998328862500/Dashboard1",
  options = { hideTabs: true, onFirstInteractive:function(){console.log("Run this code when 
  the viz has finished loading."); } };var viz = new tableau.Viz(containerDiv, url, options);}
  </script>
</head>
<body onload="initViz();">
    <div id="vizContainer" style="width:800px; height:700px;"></div>
</body>
</html>
  ``` 

嵌入時所需的 URL 格式與您在瀏覽器地址欄中看到的格式不同。 您應該用於該可視化的 URL 是https://public.tableau.com/views/OlderWorkers_15998328862500/Dashboard1 您可以通過從共享按鈕復制鏈接來獲取此 URL。

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM