Child Windows in Shiny

shiny

#1

Dear Community,
is there a way to open a second window from a running shiny app. I would like to use this as an image viewer that is "floating" above the windows with the plotted values. So the user can click a datapoint and the image from which the datapoint was generated would open in a new window.
Thanks for the help.
Alex


#2

Will the showModal function in shiny work for you?

See this article for an explanation.


#3

Dear radmuzon,
thanks a lot for your hint. This works pretty well. Here is a small sample of the implementation:

library(magick)
image <- image_read('path_to_your.tiff')
image_png <- image_convert(image, "png")
image_write(image_png, "www/temp.png")
shinyApp(
  ui = basicPage(
    actionButton("show", "Show modal dialog")
  ),
  server = function(input, output) {
    observeEvent(input$show, {
      showModal(modalDialog(
        title = "Your Image",
        "Here is the selected image!",
        HTML('<img src="temp.png" width="550" >'),
        size="l",
        fade=F,
        easyClose = TRUE
      ))
    })
  }
)
ยดยดยด