Using the Google Chart Tools with R:googleVis-0.5.8 Package VignetteMarkus Gesmann∗, Diego de Castillo†Contact: [email protected] 21, 20
2.3 Motion Chart ExampleFollowing the documentation of the Google Motion Chart API we need a dataset which has at least four columns: one identifying
R> M$type[1] "MotionChart"R> M$chartid[1] "MotionChartID212d6d31dc7d"The html output is a list with header, chart, caption a
[1] "jsHeader" "jsData" "jsDrawChart" "jsDisplayChart"[5] "jsFooter" "jsChart" "divCh
],["Oranges",2008,"East",96,81,15,"2008-12-31"],["Bananas",2008,"East",85,76,9,"2008-12-31"
["Bananas",2010,"East",81,71,10,"2010-12-31"]];data.addColumn('string','Fruit');data.addColumn(&apos
var i, newPackage = true;for (i = 0; newPackage && i < pkgs.length; i++) {if (pkgs[i] === chartid)newPackage = false;}if (newPackage)pkgs.p
R> cat(M$html$chart['jsChart']) # or print(M, 'jsChart')<!-- jsChart --><script type="text/javascript" src=&
1. Go to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html2. Click on the dropbox which says ’Edit location’
2.6 Combining charts with gvisMergeThe function gvisMerge takes two gvis-objects and merges the underlying com-ponents into one page. The charts are a
2.7 Setting optionsSetting the various options of a googleVis objects can be a bit cumbersome atfirst. The options follow those of the Google Charts AP
Contents1 Introduction 41.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Google Chart Tools . . . . . . . . . . . . .
+ ))R> plot(Line)As you can see from the example above, the simpler options can be set by name=value,e.g. width=500, while the more complex options
Figure 6: A geo chart with options set for a colour axis.2.7.1 Chart EditorA special option for all charts is gvis.editor, which adds an edit button t
Figure 7: Example of googleVis chart with options = list (gvis.editor =’Edit me!’).Year Lloyd\\'s Munich Re\\'s R/I1 2009 86.1 95.32 2010 93
Figure 8: Visualising data with apostrophes in column names.R> print(M, 'chart', file='myfilename')and process it from there.3.
Figure 9: Including googleVis output in a WordPress blog entry.and paste it into the value text area of a custom field in WordPress, e.g. with in-stanc
R> M <- gvisMotionChart(Fruits, "Fruit", "Year")R> G <- createGoogleGadget(M)R> cat(G, file="myGadget.xml"
3.4.1 Using googleVis with R.rspThe R.rsp package allows the user to integrate R code into html code. The Rcode is parsed by the R.rsp web server and
Detailed installation instructions for RApache are available on the project site:http://rapache.net/manual.html, for specific comments on Mac OS X see:
That’s all. Restart the HTTP daemon and you can start placing files in the brewdirectory and access them via http://localhost/rapache/brew/filename, e.
Figure 10: Screen shot of a Rook app with googleVis output.+ data <- Exports[,1:2]+ ## Add functionality to upload CSV-file+ if (!is.null(req$POST(
7 Frequent ask questions – FAQ 377.1 Can I use googleVis output in PDF files? . . . . . . . . . . . . . . . 377.2 Can I change the colour of the bubble
+ <input type="submit" name="Go">\n</form>')+ res$write(tbl$html$footer)+ res$finish()+ }R> s$add(app=my.app,
+ htmlOutput("view")+ )+ ))Figure 11: Screen shot a shiny app with googleVis output.You can run the example locally with the following state
4 Using googleVis with knitrUsing googleVis with knitr9[Xie13] is a convient way of creating interactivereproducible reports. The approach taken by kn
Figure 12: Screen shot of the markdown example output## Combo chart```{r ComboExample, results='asis', tidy=FALSE}## Add the meanCityPopular
## Place two charts next to each other```{r gvisMergeExample, results='asis', echo=FALSE}Geo <- gvisGeoChart(Exports, locationvar='C
An alternative would be to build the presentation as a web page itself.A popular approach here is the slifiy package by Ramnath Vaidyanathan, [Vai12]t
table.draw(data, options);google.visualization.events.addListener(table, 'select', selectHandler);function selectHandler() {alert('A ta
7 Frequent ask questions – FAQ7.1 Can I use googleVis output in PD F files?No, not directly.The Google Charts API is designed for dynamic web output on
7.6 How can I set axes limits with googleVis?Unfortunately, there are no arguments such as ylim an d xlim. Instead, the GoogleCharts axes options are
issues/list8 Contact8.1 CollaborationObviously, the package is work in progress and there are many other functions ofthe Google Charts A PI which are
1 Introduction1.1 MotivationMore and more data is becoming available, and yet stories and insights are still oftenmissed: we are lost in the data jung
[GdC13] Markus Gesmann and Diego de Castillo. googleVis Tutorial, 2013.[GdC14] Markus Gesmann and Diego de Castillo. go ogleVis: Using the GoogleChart
[Xie13] Yihui Xie. knitr: A general-purpose package for dynamic report generationin R, 2013. R package version 1.1.41
Y-axisClick here to select indicators for the y-axis.Lin / Log scaleX- and y-axis scales can be linear or logarithmic. A log scale can make it easier
18 ['Apples',new Date(1988,0,1),1000,300,'East'],19 ['Oranges',new Date(1988,0,1),1150,200,'West'],20 ['B
Figure 2: Screenshot of some of the outputs of demo(googleVis). Clock-wise from top left: gvisMotionChart, gvisAnnotatedTimeLine, gvisGeoMap,gvisTreeM
2.1 InstallationYou can install googleVis in the usual way from CRAN, e.g.:R> install.packages('googleVis')The installation was successfu
Figure 3: Schematic structure of a gvis list object.data requirements follow those of the Google Charts API and are documented inthe help pages, seeR&
Comments to this Manuals