Charts 尝试通过ajax将数据提取到google图表时,获取“轴0的数据列不能是字符串类型”
我在页面上有个问题 资料来源是:Charts 尝试通过ajax将数据提取到google图表时,获取“轴0的数据列不能是字符串类型”,charts,Charts,我在页面上有个问题 资料来源是: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript">
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "getData.php",
dataType:"json",
async: false
}).responseText;
var options = {
title: 'Temperatur'
};
var data = new google.visualization.DataTable(jsonData);
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
}
我得到以下错误:
轴0的数据列不能是字符串类型
{
"cols": [
{
"id": "",
"label": "Zeit",
"pattern": "",
"type": "datetime"
},
{
"id": "",
"label": "Temperatur",
"pattern": "",
"type": "string"
}
],
"rows": [
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 08, 00)"
},
{
"v": 22.2
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 11, 00)"
},
{
"v": 22.2
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 14, 00)"
},
{
"v": 22.2
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 17, 00)"
},
{
"v": 22.2
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 20, 00)"
},
{
"v": 21.7
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 23, 00)"
},
{
"v": 21.7
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 26, 00)"
},
{
"v": 21.7
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 29, 00)"
},
{
"v": 21.7
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 32, 00)"
},
{
"v": 21.7
}
]
},
{
"c": [
{
"v": "Date(2013, 6, 14, 06, 32, 00)"
},
{
"v": 21.7
}
]
}
]