I have a shiny app that takes a module to do the multiple graph and I want to display these graph in multiple different places in the main Shiny UI. For example the below code has one moduleserver function that generate plot1 and plot2 which is also mention in the module ui part. But I dont know how I will call plot1 and plot2 separately.
- This is module code:
mod_dt_UI <- function(id) {
ns <- NS(id)
tagList(
uiOutput(ns("plot1")),
uiOutput(ns("plot2")),
uiOutput(ns("plot3"))
)
}
mod_dt_Server <- function(id, dsin) {
moduleServer(
id,
function(input, output, session) {
output$plot1<- renderPlotly({
Some graph code.
})
output$plot2<- renderPlotly({
Some graph code.
})
output$plot3<- renderPlotly({
Some graph code.
})
}
)
}
- This is the main App UI and server
ui <- fluidPage(
mod_dt_UI("plot1") #These plot will be displayed in different pages in the SHiny app.
mod_dt_UI("plot2") #These plot will be displayed in different pages in the SHiny app.
mod_dt_UI("plot3") #These plot will be displayed in different pages in the SHiny app.
)
# Define the server function
server <- function(input, output, session) {
# Call the module and assign its output to the placeholder
mod_dt_Server(id="plot1", dsin=df)
}
Tried to access using mod_dt_UI("plot1")
but not able to get what I want. All plots together.