I am trying to create a googleVis MotionChart with the Google Visualization API, using the R package.
My problem is that I would like to publish the MotionChart on the internet and for this I want to be able to control the default variables for the different axis/dimensions.
A lot of information can be set using:
gvisMotionChart(M, options=list(state='xxx')
Where 'xxx' is the state which can be copied from the Advanced tab in a MotionChart, however the default time series are not included in the state.
My question is, how can I choose the default variables for the different axis/dimensions of the googleVis MotionChart?
Below is a little interface function to gvisMotionChart that allows to specify default values for xvar,yvar, colorvar and sizevar in addition to idvar and timevar. It accomplishes this by simply changing the column order of the provided data.frame. The function also transforms booleans into numbers (otherwise gvisMotionChart throws an error). Since I the motion chart also quite convenient for analyzing cross sectional data, it allows to set timevar=NULL.