location <- function(location, ...) cat(location$x, "x", location$y, "\n")
mtcars %>% ggvis(~mpg, ~wt) %>% layer_points() %>%
handle_click(location)
mtcars %>% ggvis(~mpg, ~wt) %>% layer_points() %>%
handle_hover(function(...) cat("over\n"), function(...) cat("off\n"))
mtcars %>% ggvis(~mpg, ~wt) %>% layer_points() %>%
handle_hover(function(data, ...) str(data))
Run the code above in your browser using DataLab