handle_click {ggvis} | R Documentation |
Handle mouse actions on marks.
handle_click(vis, on_click = NULL) handle_hover(vis, on_mouse_over = NULL, on_mouse_out = NULL)
vis |
Visualisation to listen to. |
on_click,on_mouse_over |
Callback function with arguments:
|
on_mouse_out |
Callback function with argument:
|
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))