このコードをスクリプトに貼り付けるとどうなりますか:
https://code.google.com/apis/ajax/playground/?type=visualization#using_the_query_language
実行すると、次のエラーが表示されます。
ReferenceError: "google" が定義されていません。
?!
このコードをスクリプトに貼り付けるとどうなりますか:
https://code.google.com/apis/ajax/playground/?type=visualization#using_the_query_language
実行すると、次のエラーが表示されます。
ReferenceError: "google" が定義されていません。
?!
「GoogleVisualizationAPI」を最初にロードする必要があります。クイックスタートに従ってください。
以下のスニペットをコンピューター上のファイルにコピーし、ブラウザーで開いて、上記の円グラフを表示できます。
リンクからのコードのスニペット:
<!--Load the AJAX API-->
<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() {
// !!! Use Google Visualization API here !!!
}
</script>
Google Visualization APIは、が呼び出された後にのみ使用できることに注意してください。drawChart