在一个闪亮的应用程序中,我正在尝试链接多个图。要做到这一点,我需要能够使用event_data("plotly_hover")
之类的东西检索悬停数据。虽然这个方法以前对我很有效,但由于某些原因,今天我遇到了一个我无法解决的问题。当我将鼠标悬停在任何绘图对象上并显示悬停事件数据时,在闪亮的应用程序中返回以下错误:
Warning: Error in cat: argument 1 (type 'list') cannot be handled by 'cat'
在过去,在情节对象上使用event_data(...)
对我来说效果很好,所以我对可能发生的事情感到困惑。下面是一些自包含的示例代码:
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)
从理论上讲,我应该看到这样的东西:
curveNumber pointNumber x y
1 0 1 1 4
但是我留下了上面的错误。对可能发生的事情有什么想法吗?
https://stackoverflow.com/questions/55342036
复制相似问题