8
我想在我的Java EE應用程序中包含Google可視化API的圖表。但是,無論我做什麼,應用程序都不會識別該API。我以前就是這樣用的,所以我不明白我做錯了什麼。有人能看我的代碼並告訴我我做錯了什麼嗎?謝謝!Jave EE應用程序無法識別Google可視化API
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link type="text/css" href="LOCATION/STYLENAME.css" rel="stylesheet"/>
<script src="/tis/javascript/common/jquery.inlinemenu.js" type="text/javascript"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
// Set chart options
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
的誤差如下:
- 的ReferenceError:谷歌沒有定義
- 方法 'setOnLoadCallback' 加下劃線並說:未解決的功能或方法 'setOnLadCallback'
你可以顯示生成的版本的來源(瀏覽器得到什麼)? –
在jsfiddle中工作:http://jsfiddle.net/r9hGH/ – BeRecursive
瀏覽器顯示沒有輸出,它在ReferenceError上斷開...在獨立頁面中確實有效。很神祕 –