Learn R Programming

ggvis (version 0.4.1)

handle_brush: Handle brush events on a visualisation.

Description

Currently for brush events to be triggered on a visualisation, you must use a .brush property. This limitation will be lifted in the future.

Usage

handle_brush(vis, on_move = NULL, fill = "black")

Arguments

vis
Visualisation to listen to.
on_move
Callback function with arguments: [object Object],[object Object],[object Object],[object Object]
fill
Colour of the brush.

Examples

Run this code
# Display tooltip when objects are brushed
mtcars %>%
  ggvis(x = ~wt, y = ~mpg, size.brush := 400) %>%
  layer_points() %>%
  handle_brush(function(items, page_loc, session, ...) {
    show_tooltip(session, page_loc$r + 5, page_loc$t, html = nrow(items))
  })

Run the code above in your browser using DataLab