Within a Shiny app, I'm trying to link multiple plots. To do this, I need to be able to retrieve hover data with something like event_data("plotly_hover"). Although this has worked for me before, today for some reason I've been running into a problem I haven't been able to troubleshoot. When I hover over any plotly object and display the hover event data, this error is returned within the Shiny app:
Warning: Error in cat: argument 1 (type 'list') cannot be handled by 'cat'
In the past, using event_data(...) on a plotly object has worked well for me so I'm left scratching my head about what may be going on. Here is some self-contained sample code:
ui <- fluidPage(
plotlyOutput("singlePlot"),
verbatimTextOutput("hoverData")
)
server <- function(input, output, session) {
output$singlePlot <- renderPlotly({
p <- plot_ly(x = 1:10, y = 1:10, color = I("red"), marker = list(color = "blue"))
p
})
output$hoverData <- renderText(event_data("plotly_hover"))
}
shinyApp(ui = ui, server = server)
In theory I should see something like this:
curveNumber pointNumber x y
1 0 1 1 4
But I'm left with the error above. Any ideas on what might be going on?