What steps will reproduce the problem?
Generate a motion chart setting its initial state according to the documentation:
suppressPackageStartupMessages(library(googleVis))
data(Fruits)
state.json <- '{"nonSelectedAlpha":0.4,"time":"2008","showTrails":true,"iconKeySettings":[],"uniColorForNonSelected":false,"xAxisOption":"_TIME","yZoomedDataMax":32,"playDuration":15000,"xZoomedDataMin":1199145600000,"colorOption":"2","orderedByY":false,"yLambda":1,"sizeOption":"5","xLambda":1,"xZoomedIn":false,"duration":{"timeUnit":"Y","multiplier":1},"yZoomedIn":false,"iconType":"BUBBLE","dimensions":{"iconDimensions":["dim0"]},"yAxisOption":"5","yZoomedDataMin":7,"xZoomedDataMax":1262304000000,"orderedByX":false}'
M <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year", options=list(state=state.json))
plot(M)
What is the expected output? What do you see instead?
Plot generated with Profit shown on the y axis and Time on the x axis. Instead, the plot is displayed with the default initial state (Expenses and Sales).
What version of the product are you using? On what operating system?
Mac OS 10.8.2.
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
locale:
[1] en_US.utf-8/en_US.utf-8/en_US.utf-8/C/en_US.utf-8/en_US.utf-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] googleVis_0.3.3 RJSONIO_1.0-1
loaded via a namespace (and not attached):
[1] tools_2.15.1
Please provide any additional information below.
This issue is similar to https://code.google.com/p/google-motion-charts-with-r/issues/detail?id=5
Thanks for your message. This is not so much a bug in the code as a lag of documentation. The state string needs a newline at the start and at the end to work. Either you enter hard returns in your string or you use '\n'. Here is a minimal example which should work for you myStateSettings <-'\n{"iconType":"LINE"}\n' M <- gvisMotionChart(Fruits, "Fruit", "Year", options=list(state=myStateSettings)) plot(M) I have updated the help file of gvisMotionChart for the state argument and added the above code to the example section to highlight the need for the newlines. You can review the changes here: https://code.google.com/p/google-motion-charts-with-r/source/diff?spec=svn346&r=346&format=side&path=/trunk/man/gvisMotionChart.Rd&old_path=/trunk/man/gvisMotionChart.Rd&old=339 I hope this helps. Markus