This app requires the shiny
and xml2
packages. Run the gist interactively with the following:
shiny::runGist('6c33ee09a16d55569c562f7aa3951088')
library(shiny) | |
library(xml2) | |
mod_image_ui <- function(id) { | |
ns <- NS(id) | |
tagList( | |
fluidRow( | |
column( | |
width = 6, | |
htmlOutput(ns("image_render")) | |
), | |
column( | |
width = 6, | |
verbatimTextOutput(ns("debugging")) | |
) | |
) | |
) | |
} | |
mod_image_server <- function(input, output, session) { | |
output$image_render <- renderUI({ | |
includeHTML("image.svg") | |
}) | |
output$debugging <- renderPrint({ | |
ns <- session$ns | |
input[['region_clicked']] | |
}) | |
} | |
ui <- fluidPage( | |
mod_image_ui("mod1") | |
) | |
server <- function(input, output, session) { | |
callModule(mod_image_server, "mod1") | |
} | |
shinyApp(ui, server) |