all_values <- function(x) {
if(is.null(x)) return(NULL)
paste0(names(x), ": ", format(x), collapse = "<br />")
}
base <- mtcars %>% ggvis(x = ~wt, y = ~mpg) %>%
layer_points()
base %>% add_tooltip(all_values, "hover")
base %>% add_tooltip(all_values, "click")Run the code above in your browser using DataLab