41
7.6 How can I set axes limits with googleVis?
Unfortunately, there are no arguments such as ylim and xlim. Instead, the Google
Charts axes options are set via hAxes and vAxes, with h and v indicating the
horizontal and vertical axis. More precisely, we have to set viewWindowMode :
’explicit’ and set the viewWindow to the desired min and max values. Addi-
tionally, we have to wrap all of this in [{}] brackets as those settings are sub-options
of h/vAxes. There are also options minValue and maxValue, but they only allow
you to extend the axes ranges.
Here is a minimal example, setting the y-axis limits from 0 to 10:
R> library(googleVis)
R> dat <- data.frame(x=LETTERS[1:10],
+
y=c(0, 4, -2, 2, 4, 3, 8, 15, 10, 4))
R> area1 <- gvisAreaChart(xvar="x", yvar="y", data=dat,
+
options=list(vAxes="[{viewWindowMode:'explicit',
+
viewWindow:{min:0, max:10}}]",
+
width=500, height=400,
+
title="y-limits set from 0 to 10"),
+
chartid="area1ylim")
R> plot(area1)
7.7 How can I change the look and feel of the charts?
The charts have a lot of options which allow you to change the look and feel
of the output, see the help files for more details. However, googleVis provides
only an interface to the Google Charts API. If you have specific questions to the
charts then please join the Google Visualisation API newsgroup: http://groups.
google.com/group/google-visualization-api.
Forfrequent ask questions regardingthe API check: https://developers.google.
com/chart/interactive/faq.
7.8 Is it possible to use googleVis in corporate work?
Review the Google Terms of Service (https://developers.google.com/terms/)
and get in touch with your colleagues in IT / Legal. If in doubt contact Google
directly.
7.9 Bugs and issues
Should you find any issues or bugs with googleVis, then please drop us a line or add
themto our issues list: http://code.google.com/p/google-motion-charts-with-r/
38