这是一个新手问题,但是如何在Google Charts 折线图中使用日期作为 x 轴?
当我使用 new Date( ... ) 时,我收到错误消息“未捕获的错误:不支持日期和日期时间列类型”
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Datum','Person1','Person2','Person3'],
[new Date(2012, 12, 19, 0, 0, 0),'5072.0537223002','5072.0537223002','5074.2809630567'],
[new Date(2012, 12, 20, 0, 0, 0),'5072.0537223002','5072.0537223002','5074.2809630567'],
]);
var options = {};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
(在 x 轴上使用字符串均匀空格是可以接受的,但是当我尝试使用字符串“轴 #0 的数据列不能是字符串类型”时)