簡體   English   中英

谷歌圖表顯示空白頁

[英]Google Charts Showing Blank White Page

我正在構建一個谷歌折線圖。 我已經通過 php 插入了我的數據,這就是 html 源代碼的樣子。 我一生都找不到為什么這只是顯示一個白頁。 我把測試這個詞放在那里以確保它正在加載並且“測試”顯示出來,但沒有別的。 Apache 日志顯示沒有錯誤。 我感謝任何幫助或建議!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="180" >

<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load("search", "1");
  google.load("jquery", "1.4.2");
  google.load("jqueryui", "1.7.2");
</script>
<script type="text/javascript">
//    google.charts.load('current', {'packages':['corechart']});
//    google.charts.setOnLoadCallback(drawChart);
google.load("visualization", "1", {packages:["corechart"], callback: drawChart});

      function drawChart() {

        var data = new google.visualization.DataTable(
data.addColumn('date', 'PollTime');
data.addColumn('number', 'Download');
data.addColumn('number', 'Upload');

data.addRows([ [new Date(2016, 5, 4, 0, 4), 294, 37],  [new Date(2016, 5, 4, 0, 13), 265, 34],  [new Date(2016, 5, 4, 0, 22), 236, 32],  [new Date(2016, 5, 4, 0, 31), 218, 33],  [new Date(2016, 5, 4, 0, 40), 225, 46],  [new Date(2016, 5, 4, 0, 49), 207, 41],  [new Date(2016, 5, 4, 0, 58), 184, 29],  [new Date(2016, 5, 4, 1, 7), 190, 31],  [new Date(2016, 5, 4, 1, 16), 181, 32],  [new Date(2016, 5, 4, 1, 25), 191, 31],  [new Date(2016, 5, 4, 1, 34), 174, 32],  [new Date(2016, 5, 4, 1, 43), 142, 32],  [new Date(2016, 5, 4, 1, 52), 135, 30],  [new Date(2016, 5, 4, 2, 1), 128, 23],  [new Date(2016, 5, 4, 2, 10), 118, 28],  ]););
 var options = {
          title: 'TelePacific Bandwidth Usage',
          width: 900,
          height: 500,
          hAxis: {
            format: 'M/d/yy HH:mm',
            gridlines: {count: 15}
          },
          vAxis: {
            gridlines: {color: 'none'},
            minValue: 0
          }
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));

        chart.draw(data, options);

        var button = document.getElementById('change');

        button.onclick = function () {

          // If the format option matches, change it to the new option,
          // if not, reset it to the original format.
          options.hAxis.format === 'M/d/yy' ?
          options.hAxis.format = 'MMM dd, yyyy' :
          options.hAxis.format = 'M/d/yy';

          chart.draw(data, options);
        };
      }

google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
test
<div id="chart_div" style="width: 500px; height: 400px;"></div>
</body>
</html>

語法錯誤。 ln var data = new google.visualization.DataTable( 應該是 var data = new google.visualization.DataTable();

然后刪除); 數據之后

暫無
暫無

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

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