2012-05-11 64 views
1

我有一個谷歌網站。我想用一個外部腳本來使我的網站上的谷歌可視化工作:外部腳本谷歌網站可視化

這是一塊腳本出錯了。

<html> 
    <head> 
    <script type="text/javascript" src="https://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
     google.load("visualization", "1", {packages:["corechart"]}); 
     google.setOnLoadCallback(drawChart); 
     function drawChart() { 
     var data = google.visualization.arrayToDataTable([ 
      ['Year', 'Sales', 'Expenses'], 
      ['2004', 1000,  400], 
      ['2005', 1170,  460], 
      ['2006', 660,  1120], 
      ['2007', 1030,  540] 
     ]); 

     var options = { 
      title: 'Company Performance', 
      hAxis: {title: 'Year', titleTextStyle: {color: 'red'}} 
     }; 

     var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); 
     chart.draw(data, options); 
     } 
    </script> 
    </head> 
    <body> 
    <div id="chart_div" style="width: 900px; height: 500px;"></div> 
    </body> 
</html> 

我加入這個腳本trhoug一個htmlbox和我得到的錯誤: 1 + 13 - 42:未能加載外部URL JSAPI

爲什麼不會itthe JSAPI加載?

回答

0

據我所知,您不能在HTML Box小工具中加載外部網站/頁面(即使是谷歌網頁)。
要做到這一點,你可以創建在谷歌小工具編輯器自定義小工具(使用Gmail帳戶),通過訪問以下網址,
    http://www.google.com/ig/ifr?url=gge.xml

,你可以把上面的代碼,而保存它,您將通過右鍵單擊鏈接並複製右側文件名中的鏈接。然後,在您的谷歌網站頁面中,
   編輯頁面 - >插入 - >更多小工具 - >通過URL添加小工具 - >粘貼上面複製的網址並保存。