Timeline charts with googleVis

8 comments
Last year at the Google I/O conference Mitchell Foley presented new developments of the Google Chart Tools API and one of the new features he mentioned were timeline charts (about 6 min into the talk).



Timeline charts are a great way of visualising different dates/events over time and are now also supported by googleVis from version 0.5.0 onwards (currently only available from GitHub). Here is an example, showing classroom allocation in the afternoon. The exact times and durations are given when you hover over the bars.



I can swap around the bar and row labels to show the rooms by languages:



Here is another example, inspired by Jason Bryer's timeline package, showing the US presidents and UK prime ministers during World War II. For gvisTimeline I have to remove the line breaks in Jason's data.



And finally a more complex example from the Google Chart Tools API documentation showing the terms of the first US presidents with various options set to change the colours and fonts:



For more information and installation instructions see the googleVis project site and Google documentation.

Session Info

R version 3.0.3 (2014-03-06)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] timeline_0.9      ggplot2_0.9.3.1   googleVis_0.5.0-3

loaded via a namespace (and not attached):
 [1] colorspace_1.2-3   dichromat_2.0-0    digest_0.6.3       grid_3.0.3        
 [5] gtable_0.1.2       labeling_0.2       MASS_7.3-29        munsell_0.4.2     
 [9] plyr_1.8           proto_0.3-10       RColorBrewer_1.0-5 reshape2_1.2.2    
[13] RJSONIO_1.0-3      scales_0.2.3       stringr_0.6.2      tools_3.0.3

8 comments :

josep2 said...

This is fantastic work. Thanks for sharing.

dksamuel said...

Real thanks for a fine piece of work

Sharon Klinkenberg said...

I was planning on using this in an ioSlide using Rstudio and knitr to generate the html but I've been at it for an hour and only getting blank pages. Running your examples separately is working fine but integrating it in a code chuck does not work. Also not as html_document in the YAML section.


How did you get the graphs on this page?

Markus Gesmann said...

You should find the relevant information in the package vignette, or alternative look at our tutorial, which was written as an ioSlide pack: http://decastillo.github.io/googleVis_Tutorial/#1

Sharon Klinkenberg said...

Thanks a lot. Got it working.

James Akim said...

Hi, I'm trying to give my timeline chart a title inside "options" but it doesn't seem to work, is it not allowed?

Markus Gesmann said...

I don't think there is an option for this. See the Google documentation for more details: https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline#Configuration_Options

James Akim said...

Okay cool thanks

Post a Comment