Here is a function that should include a title to the chart. The input is either an HTML string or a shiny.tag.
addGvisATLTitle <- function(gvisATL,title) {
if (!all(class(gvisATL) == c("gvis","list"))) {
stop('ERROR in addGvisATLTitle: Incorrect type, expect gvisAnnotatedTimeLine.')
}
if (class(title) == "character") {
gvisATL$html$chart['divChart'] <- paste(title,gvisATL$html$chart['divChart'],sep="")
} else if (class(title) == "shiny.tag") {
gvisATL$html$chart['divChart'] <- paste(as.character(title)[1],gvisATL$html$chart['divChart'],sep="")
} else {
stop('ERROR in addGvisATLTitle: Unknown title type.')
}
return(gvisATL)
}
you can test it out with
a <- data.frame(date=Sys.Date(),val=20)
b <- gvisAnnotatedTimeLine(a)
plot(addTitle(b,"<h1> My chart </h1>"))
plot(addTitle(b,h1("My chart")))
- I have updated it to work with gvisMerge