Javascript 谷歌图表:对象没有方法';getTime';
我正在使用谷歌图表(折线图),在xAxis上有一个日期时间,在yAxis上有一个数字。 我激活了水平缩放,但每次尝试放大时都会出现以下异常:Javascript 谷歌图表:对象没有方法';getTime';,javascript,google-visualization,Javascript,Google Visualization,我正在使用谷歌图表(折线图),在xAxis上有一个日期时间,在yAxis上有一个数字。 我激活了水平缩放,但每次尝试放大时都会出现以下异常: Uncaught TypeError: Object 1387717025773 has no method 'getTime' format+de,default+de,ui+de,corechart+de.I.js:826 我用以下示例代码在google代码游乐场中重现了这个问题: function drawVisualization() { /
Uncaught TypeError: Object 1387717025773 has no method 'getTime' format+de,default+de,ui+de,corechart+de.I.js:826
我用以下示例代码在google代码游乐场中重现了这个问题:
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['time', 'test'],
[new Date(1387717025701), 1],
[new Date(1387717025801), 2],
[new Date(1387717025901), 4],
[new Date(1387717026001), 8],
]);
// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function",
width: 500, height: 400,
vAxis: {maxValue: 10}, title: 'test',
//hAxis: {maxValue: 10},
hAxis: {format: "HH:MM:ss"},
explorer: { actions: ['dragToZoom', 'rightClickToReset'], axis: 'horizontal'}
});
}
只需粘贴上面的代码,并尝试通过拖动放大。在浏览器(我使用的是chrome)控制台中,应该会出现错误
提前谢谢 谷歌已经报道并接受了这一问题。见第1395期 如果您选择垂直轴而不是水平轴,您的行为可能会稍好一些
dragToZoom
起作用,但当您使用右键单击重置图表时,会出现相同的错误