2011-11-04 58 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