当我尝试在我的WAMP-Server上加载我的网站时,它给了我这个错误:
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>
谁能告诉我这个错误来自哪里?
答案 0 :(得分:5)
该文件的标题不适用于pieChart。将其更改为
Name,Work
Jochen,2
Peter,5
Hans,2
Detlef,3
Jürgen,4
Andreas,6
Martin,4