Skip to contents

Plots send these events to Shiny by default: plotly_hover, plotly_click, plotly_selected, plotly_relayout, plotly_brushed, plotly_brushing, plotly_clickannotation, plotly_doubleclick, plotly_deselect, plotly_afterplot and plotly_sunburstclick. event_register() adds others (e.g. plotly_legendclick); event_unregister() removes events. event_source() sets the source id that event_data() uses to tell plots apart (default "A").

Usage

event_register(p, event = NULL)

event_unregister(p, event = NULL)

event_source(p, source)

Arguments

p

A go_figure() or plotly htmlwidget.

event

An event name (see event_data()).

source

A string identifying the plot.

Value

The modified figure.

Examples

fig <- go_figure(go_scatter(y = 1:3)) |>
  event_source("scatter") |>
  event_register("plotly_legendclick")