Skip to content

event_data() triggering unexpected warning about registering #1528

Description

@bklingen

Using event_data("plotly_hover", source="mysource") seems to trigger the following warning with the newest plotly version:
Warning: The 'plotly_hover' event tied a source ID of 'mysource' is not registered. In order to obtain this event data, please add event_register(p, 'plotly_hover') to the plot (p) that you wish to obtain event data from.

library(shiny)
library(plotly)

ui <- fluidPage(
        plotlyOutput("myplot"),
        verbatimTextOutput("hovered")
      )

server <- function(input, output, session) {
    
    output$myplot <- renderPlotly({
        p <- plot_ly(faithful, x=~eruptions, y=~waiting, source="mysource")
        return(p)
    })
    
    output$hovered <- renderPrint({
      event_data("plotly_hover", source="mysource")
    })

}

shinyApp(ui = ui, server = server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions