Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot view gvisMotionChart from printed html file

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?

like image 582
Tom Avatar asked Nov 04 '11 13:11

Tom


2 Answers

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.

like image 98
Tony Breyal Avatar answered Oct 13 '22 00:10

Tony Breyal


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

like image 37
ljarvio Avatar answered Oct 13 '22 00:10

ljarvio