Reading from the googleVis package vignette: "With the googleVis package users can create easily web pages with interactive charts based on R data frames and display them either via the R.rsp package or within their own sites". Following the instructions I was able to see the sample charts, using the plot method for gvis objects. This method by default creates a rsp-file in the rsp/myAnalysis folder of the googleVis package, using the type and chart id information of the object and displays the output using the local web server of the R.rsp package (port 8074 by default).
Could anybody help me (or provide some link) on the procedure someone has to follow in order to embed such charts into an existing web site (e.g. a joomla site)?
Obviously I think that this is too verbose for @gd047, but I put a kind of tutorial since it maybe helpful for other readers who want to use googleVis on their own website.
install googleVis from CRAN
install.packages('googleVis')
pay attention to the messages.
then, create gvis object:
library(googleVis) M <- gvisMotionChart(Fruits, "Fruit", "Year")
you can find the contents of M by:
> M
and you can find the plot on your browser:
> plot(M)
then, what is necessary to generate the chart is M$html$chart:
> M$html$chart [1] "<!-- MotionChart ... omitted... \">\n</div>\n"
save it to a file:
> cat(M$html$chart, file="tmp.html")
if you open the "tmp.html" as a file (i.e, address says files:///***/tmp.html), then security warning may occur. What you need is to access the html via http://.
So if you can edit any web page where <script> tag is available (e.g., blogger), you can use it by simply copy and paste the contents of tmp.html, like this:
http://takahashik.blogspot.com/2011/01/googlevis-example.html
here is the famous "iris" version of example:
http://takahashik.blogspot.com/2011/01/googlevis-example-for-data-iris_10.html
Otherwise, if you have a web server, you can use it by uploading the tmp.html on the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With