+ ))
R> plot(Line)
As you can see from the example above, the simpler options can be set by name=value,
e.g. width=500, while the more complex options with sub-components are listed in
curly brackets {}, and arrays, e.g. to define the two axes, use square brackets [ ].
Generally the following rules apply:
• parameters with names that do not include a ”.” are set with a single value,
e.g. width and height. Those are set like one would do in R, that is
options=list(width=200, height=300). Boolean arguments are set to
either TRUE or FALSE, using the R syntax.
• parameters with names that do not include a ”.” and are set with multi-
ple values, e.g. color, and are wrapped in ”[ ]”, e.g. options=list(
colors="[’#cbb69d’, ’#603913’, ’#c69c6e’]")
• parameters with names that do include a ”.” present parameters with several
sub-options and have to be set as a string wrapped i n ”{ }”. The values
of those sub-options are set via parameter:value. Boolean values have to
be stated as ’true’ or ’false’. For example the Google documentaion
states the formating options for the vertical axis and states the parameter
as vAxis.format. Then this paramter can be set in R as: options=list(
vAxis="{format:’#,###%’}").
• If several sub-options have to be set, e.g. titleTextStyle.color, title-
TextStyle.fontName and titleTextStyle.fontSize, then those can be
combined in one list item such as: options=list( titleTextStyle="{color:’red’,
fontName:’Courier’, fontSize:16}")
• paramters that can have more than one value per sub-options are wrapped in
”[ ]”. For example to set the labels for left and right axes use: options=list(
vAxes="[{title:’val1’}, {title:’val2’}]")
The following example set the colour axis of a geo chart, see Figure 6:
R> Geo <- gvisGeoChart(CityPopularity, locationvar='City',
+ colorvar='Popularity',
+ options=list(region='US', height=350,
+ displayMode='markers',
+ colorAxis="{values:[200,400,600,800],
+ colors:[\'red', \'pink\', \'orange',\'green']}")
+ )
R> plot(Geo)
20
Comentários a estes Manuais