
Figure 6: A geo chart with options set for a colour axis.
2.7.1 Chart Editor
A special option for all charts is gvis.editor, which adds an edit button to the
page, allowing the user to edit, change and customise the chart on the fly, see
the following example and Figure 7. The content of the list item gvis.editor
describes the label of the browser button
6
.
R> Editor <- gvisLineChart(df, options=list(gvis.editor='Edit me!'))
R> plot(Editor)
2.7.2 Dealing with apostrophes in column names
The googleVis package converts data frames into JSON objects. The column
names of the resulting JSON tables are encapsulated with single speech marks, see
lines 12 – 16 of the code example on page 5.
Hence apostrophes in column names of your input data frame have to be encapsu-
lated by a double backslash.
Here is a little example, see the output in Figure 8.
R> df <- data.frame("Year"=c(2009,2010), "Lloyd\\'s"=c(86.1, 93.3),
+ "Munich Re\\'s R/I"=c(95.3, 100.5),
+ check.names=FALSE)
R> df
6
See also https://google-developers.appspot.com/chart/interactive/docs/drawing_
charts#charteditor
21
Comentários a estes Manuais