Description
Hi,
I tried a couple combinations but couldn't get it to work, please advise:
`
library(shiny)
library(shinyBS)
library(plotly)
Module.testUI <- function(id){
ns <- NS(id)
plotlyOutput(ns('ply_main'))
}
Module.test <- function(input, output, session, sess) {
ns <- session$ns
output$ply_main <- renderPlotly({
df1 <- data.frame(x = 1:10, y = 1:10)
plot_ly(df1, x = ~x, y = ~y) %>% add_markers()
})
observe({
# eventdata <- event_data(ns('plotly_click'))
eventdata <- event_data('plotly_click',source = ns('ply_main'))
# eventdata <- event_data('plotly_click')
isolate({
print(eventdata)
})
})
}
ui <- fluidPage(
tagList(
Module.testUI('test'),
Module.testUI('test2')
)
)
server <- function(input, output) {
callModule(Module.test,'test', sess)
callModule(Module.test,'test2', sess)
}
shinyApp(ui = ui, server = server)
`