Configure global interplay (interactions) for the chart.
See gauge_interplay()
to customise figure-level interplay.
interplay(g, ...) remove_interplay(g, ...) register_interplay(g, name, ...)
g | An object of class |
---|---|
... | String(s) defining interactions. |
name | Name of interaction to register |
# global interaction on chart df <- data.frame( x = letters, y = runif(26) ) g2(df, asp(x, y)) %>% fig_interval( selected(fill = "orange") ) %>% interplay("element", "selected") # brush g2(cars, asp(speed, dist)) %>% fig_point(asp(interplay = "brush")) # register df <- data.frame( x = c(letters, letters), y = runif(52), grp = c(rep("a", 26), rep("b", 26)) ) g2(df, asp(x, y, color = grp)) %>% fig_interval( asp(interplay = "element-highlight-by-color"), adjust("dodge") ) %>% register_interplay( "element-highlight-by-color", start = list( list( trigger = "element:mouseenter", action = "element-highlight-by-color:highlight" ) ), end = list( list( trigger = "element:mouseleave", action = "element-highlight-by-color:reset" ) ) )