簡體   English   中英

Google可視化API-錯誤:標頭類型未知:1

[英]Google Visualization API - Error: Unknown header type: 1

當我嘗試在WAMP服務器上加載網站時,出現以下錯誤:

Error: Unknown header type: 1
https://www.google.com/uds/api/visualization/1.0/c3581c99759b4a64cb69ca21ab634266/format+en,default+en,ui+en,corechart+en.I.js
Line 171

這是我的代碼:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>SO Q#</title>
<style type="text/css">
html {
    height: 100%; 
    width:  100%
}
body {
    height:  100%; 
    width:   100%; 
    margin:  0; 
    padding: 0
}
#chart { 
    height: 100%; 
    width:  100% 
}
</style>
<script language="javascript" type="text/javascript" src="https://www.google.com/jsapi"></script>
<script language="javascript" src="../js/jquery.js"></script>
<script language="javascript" src="../js/jquery.csv.js"></script>
<script language="javascript" type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
    $.get("https://docs.google.com/spreadsheet/pub?key=0Ao6fMN9Cw0GPdFVtZ29iYmd1cmRORU0yemYxUjE3OVE&single=true&gid=0&output=csv",    function(csvString) {
    var arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});
    var data = new google.visualization.arrayToDataTable(arrayData);
        var view = new google.visualization.DataView(data);
        view.setColumns([0,1]);
        var options = {
            title: "A Chart from a CSV!",
            legend: 'none'
        };
        var chart = new google.visualization.PieChart(document.getElementById('chart'));
        chart.draw(view, options);
    });
}
</script>
</head>
<body>
<div id="chart"></div>
<script>
</script>
</body>
</html>

誰能告訴我這個錯誤來自哪里?

該文件的標題不適用於pieChart。 將其更改為類似

Name,Work
Jochen,2
Peter,5
Hans,2
Detlef,3
Jürgen,4
Andreas,6
Martin,4

暫無
暫無

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

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