Flexible width and height of pre-rendered image using Shiny and renderImage() -


i calling bunch of pre-rendered images shiny app using renderimage(). these png images in sidebar , adjust in width , height depending on browser or device type (e.g., chrome, android). thus, want app mobile friendly. can't figure out how make flexible (e.g., max-width = 500px or width = 100% in other languages).

a simple example:

shinyui(fluidpage(   titlepanel("title panel"),    sidebarlayout(     sidebarpanel( "sidebar panel",                   sliderinput("route", label = "route number:",                               min = 1, max = 5, value = 1),                   imageoutput("image")),     mainpanel("main panel")   ) )) 

and server.r:

shinyserver(function(input, output) {   output$image <- renderimage({     filename <- normalizepath(file.path('www/maps',                                         paste(input$route, '.png', sep='')))         list(src = filename,          alt = paste("image number", input$route))    }, deletefile = false) }) 

cheers,

caitlin

figured out myself. far know, there no way handle in r. instead, use style sheet (e.g., bootstrap.css) adding this:

   img {       border: 1;       max-width: 100%;     }     element.style {       width: 33.33%;     } 

i successful in getting work leaflet map in shiny. did in style sheet:

div#mychart2 {   width: inherit; } 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -