2011-11-04 60 views
10

当我将运动图表的代码保存到html文件并尝试打开它时,我看到页脚,“初始化”进度条瞬间闪烁,但没有其他显示向上。无法从打印的html文件中查看gvisMotionChart

所以

M1 <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year") 
plot(M1) 

的伟大工程,但

print(M1, file='d:/delete/fruit.html') 

,然后打开在浏览器中生成的文件出现空白(除页脚)。有没有一种方法可以保存这种可视化效果并将其流通?

+0

I can't reproduce your problem -- printing produces a working file for me. You should try printing without specifying a file, which spits out the html in your R session. You can look this over and copy it to a file if nothing is missing. – Fojtasek

回答

12

据我了解,该文件已通过Web服务器上显示,以显示图表

http://code.google.com/apis/chart/interactive/docs/gallery/motionchart.html#Notes

由于闪存的安全设置,这(和所有基于Flash的 可视化)当从浏览器中的文件 位置(例如,file:/// c:/webhost/myhost/myviz.html) 而不是从web服务器URL(例如, http://www.myhost.com/myviz.html)访问时可能无法正确工作。这通常只是一个测试问题 。您可以按照Macromedia网站 网站上的说明解决此问题。

R中的plot命令使用内部R http帮助服务器来克服此限制。

这里是我如何克服:

  1. 转到http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
  2. 点击它说“修改位置”,然后选择“添加位置”
  3. 点击“浏览文件夹”
  4. 保管箱选择您保存html文件的文件夹
  5. 单击确定

现在打开您的googleVis html文件,它应该显示成功。实际上,您从所选文件夹中打开的任何googleVis文件也会按照您的预期显示。

+0

Amazing, thank you Tony! I'm getting to a dangerous state where I'm starting to believe there's *nothing* the good people at SO can't figure out! – Tom

+0

@Tom no worries mate, happy to help. I had the same problem earlier this year and it took about an entire day to figure it out so hopefully I've saved you a bit of time. –

+0

Do you know of a way to fix this for people who would like to watch your plots, so that they don't have to do this procedure? – PascalVKooten

-4

答案是没有详细说明之前。 这个问题是FLash真正的原因。 但你必须改变三个地方: 第一:全局存储设置面板:选择不要问! 秒:全局安全设置面板:选择总是允许! 第三:网站存储设置面板:选择不要问! 三次设置后,再次打开html文件。我相信你会看到它!

上面的意思是:这个问题是应为flash的安全设置引起的,所以我们要设置一下,具体要设置三个方面: 第一:全局存储设置:选择不在询问 第二:全局安全设置:选择 始终允许 第三:web站点存储设置:选择 不再询问。 设置好以后,重新打开html文件。

+0

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Siddharth