Google Visualization API 在本地工作,但不在外部服务器上工作?
我正在使用 Google Visualization API 和 jQuery 构建一个动态饼图来显示选举结果,并且我让它(在某种程度上)在我的本地计算机上运行,并且想要获得一些反馈,因此现在将其上传到外部服务器我尝试加载的所有内容都会出现“无数据”错误。
我有两个文件,一个从数据库获取数据并将其转换为 JSON,另一个显示可视化效果,具体取决于检查的区域。您可以在这里查看:
http://www2.lichfielddc.gov.uk /sandbox/pie.php?electionid=14
有什么想法我哪里出错了吗?
干杯
I'm building a dynamic pie chart to show election results using the Google Visualization API and jQuery, and I had it (sort of) working on my local machine, and wanted to get some feedback, so uploaded it to an external server, now everything I try to load gives me a "No Data" error.
I've got two files, one which gets data from a database and converts it to JSON, and one which displays the visualization, depending on what areas are checked. You can see it here:
http://www2.lichfielddc.gov.uk/sandbox/pie.php?electionid=14
Any ideas where I'm going wrong?
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想我可能正在做某事。
我下载了它并在本地进行了测试,正如您所说,它工作正常。但是,在我使用的数据源(data.php)中,如果我设置延迟(睡眠(1)),它就会停止工作。我认为这是因为您正在从 ajax 成功回调中绘制图表。
试试这个:
Think I may be on to something.
I downloaded it and tested it locally and as you said it works fine. However, in the datasource i was using (data.php) if I put a delay (sleep(1)) it stopped working. I think it was because you were drawing the chart out of the ajax success callback.
Try this:
单步执行代码:当您调用draw()方法时,对象“data”中没有数据。这可能是因为对数据对象的修改不在同一范围内。
Stepping through the code: By the time you call the draw() method, the object 'data' has no data in it. This is likely because the modifications to the data object are not in the same scope.
我同意 Tribal 的观点,这是一个时间问题,因为现场版本有时确实有效。还有一些其他潜伏的错误,它们并不是当前问题的背后,但是...
polls.join()
返回一个字符串,它不会就地进行连接。并且url
没有被声明为局部变量I agree with Tribal that it's a timing issue, because the live version does work sometimes. There's a couple of other lurking bugs, that aren't behind the presenting issue, but ...
polls.join()
returns a string, it doesn't do the join in-situ. Andurl
isn't being declared as a local variable