[R] googleVis motionchart - slow with Date class

Gesmann, Markus Markus.Gesmann at lloyds.com
Mon Oct 31 19:45:49 CET 2011


Hi Matt,

In general my first approach would be to contact the package maintainer/author with questions.

The World Bank example with monthly data runs quite smoothly on my PC using Windows XP and IE7.
However, I can see that the performance deteriorates compared to the original demo.

The gvisMotionChart function currently only accepts a time variable as numeric or a date variable.
My understanding is that if you use a date variable the Google API will interpolate all missing days, which increases the work load for the rendering engine. 

Alternative time dimension would be acceptable by the API as well, e.g. weekly or monthly data, see:
http://code.google.com/apis/chart/interactive/docs/gallery/motionchart.html
This could improve the performance also for monthly data.
Currently gvisMotionChart doesn't accept weekly or quarterly data, but it is something to consider for a future version.

For the time being you could upload your data to a Google Spreadsheet and play around with the motion chart gadget to understand if the performance of your data would improve if you would change your time variable to weekly or quarterly data.

I hope this helps.

Kind regards

Markus

 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Matt Pocernich
Sent: 31 October 2011 16:11
To: r-help at r-project.org
Subject: [R] googleVis motionchart - slow with Date class


Hi,

I am trying to create a googleVis motion chart with monthly data.  When formatting the date column as a Date class variable, the plot as presented in the browser becomes considerably slower and very prone to crashing the browser.  To illustrate this issue I have modified the WorldBank demo.

### objects from demo("WorldBank", package = "googleVis") M <- gvisMotionChart(subData, idvar="country.name", timevar="year", options=list(width=700, height=600))
plot(M)

This works fine and I can smoothly move back and forth between the scatter plots and the line plots. 


## here I express the date as a Date class object - arbibrarily assigning each year to June 1st.

subData$year2 <- as.Date(ISOdate(subData$year, 6, 1 ))

M2 <- gvisMotionChart(subData, idvar="country.name", timevar="year2", options=list(width=700, height=600))
plot(M2)

Using Chrome,  this plot is very slow to load and it appears when pressing play that the date field fills in each day of the year.
Trying to go back and fourth between the line plot and the scatter plot will crash the browser.

Is there a better way to express monthly data?  I have tried converting it to a numeric in the form of yyyymmdd or yyyymm, but this didn't work?
I am also wondering. is the best place to post a question about googleVis?  I notice threads on stackoverflow and other places.

Thanks,

Matt
 		 	   		  
	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
**********************************************************************
The information in this E-Mail and in any attachments is...{{dropped:27}}



More information about the R-help mailing list