Cannot view gvisMotionChart from printed html file

2019-03-18 16:55发布

问题:

When I save the code for a Motion Chart into an html file and try to open it, I get the footer and the "initializing" progress bar blinks for a split second, but nothing else shows up.

so

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

works great, but

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

and then opening the resulting file in a browser comes up blank (except for the footer). Is there a way I can save this visualization and circulate it around?

回答1:

As I understand it, the file has to be displayed via a web server to show the chart

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

Because of Flash security settings, this (and all Flash-based visualizations) might not work correctly when accessed from a file location in the browser (e.g., file:///c:/webhost/myhost/myviz.html) rather than from a web server URL (e.g., http://www.myhost.com/myviz.html). This is typically a testing issue only. You can overcome this issue as described on the Macromedia web site.

The plot command in R uses the internal R http help server to overcome this limitation.

Here's how I overcame it:

  1. Go to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
  2. Click on the dropbox which says 'Edit location' and choose 'add location'
  3. Click 'browse for folder'
  4. Choose the folder in which you saved your html file
  5. Click OK

Now open your googleVis html file and it should display successfully. In fact, any googleVis file you open from within the folder you selected will also display as you would expect.



回答2:

On Google Chrome v21 & Windows 7, there is an issue with 'browse for folder' : it will open the 'browse for files' -window which does not allow you to choose a folder correctly. For now, a workaround is to disable the PepperFlash -plugin: for details see

https://productforums.google.com/forum/#!starred/chrome/qdBApWR6xPc%5B1-25%5D



回答3:

The answer before is not detail. This problem is real cause by FLash. but your have to change three place: first: Global Storage Settings panel:select Dont ask! second:Global Security Settings panel :select Always allow! third:Website Storage Settings panel :select Don't ask! After the three setting, open the html file again.I am sure you will see it !

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