谷歌图表可视化实例化问题仪表板
我正在尝试为我的网页创建一个仪表板,但无法实例化该仪表板。
var dashboard = new google.visualization.Dashboard(document.getElementById("marketareas_div"));
和 API 调用:
<script type="text/javascript"
src='https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1.1","packages":["corechart"]}]}'/>
问题:“google.visualization.Dashboard 不是构造函数”。
Im trying to create a Dashboard for my webpage but I cant instantiate the Dashboard.
var dashboard = new google.visualization.Dashboard(document.getElementById("marketareas_div"));
and the apicall:
<script type="text/javascript"
src='https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1.1","packages":["corechart"]}]}'/>
Problem: "google.visualization.Dashboard is not a constructor".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您需要关闭该脚本标签,否则页面将在某些浏览器中中断。
问题似乎是,当您将脚本包含在来自 google 的 corechart 包中时,没有仪表板对象。将其更改为包含仪表板的控件。
更多信息:
http://code.google.com /intl/sv-SE/apis/chart/interactive/docs/gallery/controls.html
First of you need to close that script-tag otherwise the page will break in some browsers.
The problem seems to be that there is no Dashboard-object when you include the script with package corechart from google. Change it to controls which includes Dashboard.
More info:
http://code.google.com/intl/sv-SE/apis/chart/interactive/docs/gallery/controls.html
您的 API 加载正确吗?
查看google的文档,你的自动加载网址不正确,应该是编码:
这个:
变成这样:
像这样调用:
他们实际上不建议使用这种方式进行加载。
尝试使用更简单的加载,例如:
Is your API correctly loaded ?
Looking at the google's documentation, your auto-loading url is not correct, it should be encoded:
This:
becomes this:
to be called like this:
They actually don't recommend using this way for loading.
Try using a more simple loading like: