ZoomStartTime 和 AnnotatedTimeLine 错误
我是 Javascript 的初学者,但上个月我有一个链接到 Google 文档文件的可用 Google 图表,该图表使用当前日期之前 90 天的图表开始日期。
我今天检查了该页面,在 Chrome 中收到消息“Object # has no method 'getTime'”,在 Firefox 中收到消息“b.zoomStartTime[y] is not a function”。两者都会停止加载图表。
我已经简化了代码来帮助我解决错误,但我没有得到任何结果......这是代码:
<script type="text/javascript">
var oldDate = new Date();
oldDate.setDate(oldDate.getDate() - 90);
</script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js">
{
"dataSourceUrl": "//docs.google.com/spreadsheet/tq?key=0AkQH6d2CUv_qdDhwd3gtZzdTVFlNX3AwX2xUSUVuclE&transpose=0&headers=-1&range=A1%3AB2436&gid=0&pub=1",
"options": {
"zoomStartTime": oldDate,
"width": 650,
"height": 371
},
"chartType": "AnnotatedTimeLine",
}
</script>
任何想法将不胜感激。
大卫.
I'm a bit of a beginner with Javascript, but last month I had a working Google chart linked to a Google Docs file, which uses a start date for the graph at 90 days before the current date.
I checked the page today and in Chrome I get the message "Object # has no method 'getTime'", and in Firefox I get the message "b.zoomStartTime[y] is not a function". Both stop the graph from loading.
I have simplified the code to help me with the error, but I'm not getting anywhere... Here's the code:
<script type="text/javascript">
var oldDate = new Date();
oldDate.setDate(oldDate.getDate() - 90);
</script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js">
{
"dataSourceUrl": "//docs.google.com/spreadsheet/tq?key=0AkQH6d2CUv_qdDhwd3gtZzdTVFlNX3AwX2xUSUVuclE&transpose=0&headers=-1&range=A1%3AB2436&gid=0&pub=1",
"options": {
"zoomStartTime": oldDate,
"width": 650,
"height": 371
},
"chartType": "AnnotatedTimeLine",
}
</script>
Any ideas would be hugely appreciated.
David.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getDate() 调用返回月份中的日期 (http:// www.w3schools.com/jsref/jsref_obj_date.asp),这会创建无效日期并导致错误。
获取与现在不同的日期的解决方案:
您可以像这样使用:
The getDate() call returns the day of the month (http://www.w3schools.com/jsref/jsref_obj_date.asp), which creates an invalid date and causes the error.
A solution for get another date than now:
You may use like this: