Sunday, 4 March 2012

googleVis 0.2.15 is released: Improved geo and bubble charts

The guys behind the Google Visualisation API don't seem to rest. On 22 February 2012 they released an update of their API. Google added options for a gradient colour axis to bubble chart and a magnifying glass to geo chart, which opens when the user hovers over cluttered markers (excluding IE<=8). Those updates have been incorporated into version 0.2.15 of the googleVis package for R.

Examples of new features

Here are two examples demonstrating the new features.

Bubble chart with gradient colour mode

Example of a bubble chart with a colour gradient axis.



The following geo chart shows the CRAN mirrors by location around the world and for how many years they have been active since 2004. I extracted the information from the R SVN-server and the CRAN_mirrors.csv file, which is placed in the /doc folder since R version 2.0.1. Not necessarily the nicest code I have ever written, but it does the job. The cities are not geo coded (no lat/long coordinates), so it takes a little time to show them all, as Google needs to figure out where they are. Hover over a cluttered marker area to bring up the magnifying glass.

Number of years cities are hosting a CRAN mirror since 2004





NEWS

googleVis 0.2.15 [2012-03-04]
----------------------------

Changes

*  Updated documentation following a new version of the Google API
   on 22 February 2012. 
     
*  Moved vignette from folder /inst/doc to /vignettes

NEW FEATURES

*  Quoted from Google
   http://code.google.com/apis/chart/interactive/docs/release_notes.html: 
   - Added gradient color mode to bubble chart.
   - Geo chart:
     o  Region interactivity in marker mode is now disabled by
      default. How to keep the old behavior? Set the
    enableRegionInteractivity option to true.

     o  Markers are now opaque by default. How to keep the old
        behaviour? Set the markerOpacity option to 0.5.

     o  Marker size is now between 3 and 12 pixels by default. How to
        keep the old behavior? Set the sizeAxis option to {minSize: 2,
        maxSize: 30}.

     o  A magnifying glass is now opened when the user hovers over
        cluttered markers (excluding IE<=8). How to keep the old
        behaviour? Set the magnifyingGlass option to {enable: false}.

     o  Maps are not stretched by default anymore, but rather kept at
       the original aspect ratio. How to keep the old behavior? Set the
   keepAspectRatio option to false.

6 comments:

  1. Hi,
    Sorry to ask here, but I can not find this anywhere.
    Is it possible to add time dynamics (like the interactive graphics / motion charts, e.g.  graphs with different size bubbles moving in 2D space when manipulating the scroll bar at the bottom) to a geo chart (or any other geographic chart in GoogleVis)? We have georeferenced data over several years. I am aware of the place marks and the example of tracking hurricane Andrew, but we would like to have different size bubbles like in motion charts.
    Also is it possible to use our own shape files (or subset of GoogleMap) as the backdrop for a such a chart? Our data is not worldwide.
    Thank you very much for your help.
    Best regards,
    Martin

    ReplyDelete
  2. I wrote in a recent post about how you can use JavaScript to animate geo charts, see
    http://lamages.blogspot.co.uk/2012/03/change-in-life-expectancy-animated-with.html You can set the display mode to markers to see bubbles moving around rather than the colour of regions.

    I hope this helps.

    ReplyDelete
  3. Antoine Stevens25 May 2012 09:37

    Hello, 

    Thanks for your very usefull package. I have a question for scatter charts. It seems now possible to change the tooltips of a scatter chart by adding a new column with a 'tooltip' role. Eg:
    function drawVisualization() {    // Create and populate the data table.    var data = new google.visualization.DataTable();    data.addColumn('number', 'X'); // series 1 data col.    data.addColumn('number', 'Y'); // series 2 data col.    data.addColumn({type:'string', role:'tooltip'});  // tooltip col.    data.addRows([    [1, 1, 'A'],    [2, 2, 'B'],    [3, 3, 'C'],    [4, 4, 'D']    ]);    // Create and draw the visualization.    var chart = new google.visualization.ScatterChart(        document.getElementById('visualization'));    chart.draw(data, {title: 'Cool shapes',                      width: 600, height: 400,                      vAxis: {title: "Y", titleTextStyle: {color: "green"}},                      hAxis: {title: "X", titleTextStyle: {color: "green"}}}              );    }
    Is this option implemented in the googleVis package? 
    Best,
    Antoine
    ​ 

    ReplyDelete
  4. Currently googleVis (version 0.2.15) doesn't support roles. Please ping us an email, if you have an idea how to do this. 

    ReplyDelete
  5. Hi Markus,


    Any progress on this? I have patched googleVis to accept tooltip data frame columns formatted as strings. Seems to work well, however I have not spent much time thinking if the approach I took is the correct one design-wise.


    It is a feature that is desperately needed and I would love to contribute if there is work already under way.

    ReplyDelete
  6. Hi Oliver,
    Please get in touch via email.

    Thanks
    Markus

    ReplyDelete