Embed Interactive Charts from R/Google Visualization API into Web Page Generated with Emacs-Org-Babel
Table of Contents
1 Introduction
The R
package googleVis
provides a R interface into the Google
Visualisation API, the latter of which offers interactive charts that can
be embedded into web pages. Using Emacs-Org-Babel mode, we can easily
generate a web page with embedded interactive chart based on a R
data
frame object. Following is an example R source code block:
#+begin_src R :exports both :results output html library(googleVis) data(Fruits) m <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year") print(m, 'chart') #+end_src
You would then see the embedded interactive chart in the html file exported from Emacs-Org mode via a web server.
If you want to view the chart (a Flash object) in a local file, as you usually do when editing an .org file, you would need to change your Flash security settings according to this solution quoted below by Tony Breyal:
- Go to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
- Click on the dropbox which says 'Edit location' and choose 'add location'
- Click 'browse for folder'
- Choose the folder in which you saved your html file
- Click OK