r - Order of two renderPlot() in Shiny -


on shiny page notice on given tabpanel, plots renderplot() statements displayed simultaneously rather 1 after another. when add sys.sleep(n) in between these renderplot ... deplays rendering, renderplot() outputs not displayed in order of execution. them display 1 after , provide user progress bar indicate plot being plotted. thanks.

ui

tabpanel          (             sidebarlayout             (                 sidebarpanel                 (                     fileinput('datasource', 'upload data',accept = c('text/csv','text/comma-separated-values','text/tab-separated-values','text/plain','.csv','.tsv'),multiple=true)                 ),                 mainpanel                 (                     fluidrow(column(width = 3, style = "background-color: transparent;", class = "well",plotoutput("comp1", height = 300,width = 300)),                     column(width = 3, style = "background-color: transparent;", class = "well",plotoutput("comp2", height = 300,width = 300))),                     tags$hr()                 )             )         ) 

server

values <- reactivevalues(df_data = null)     observeevent(input$datasource, { values$df_data <- read.csv(input$datasource$datapath)})          comp1 <- reactive({     plcomp1 <- eqcomp1(values$df_data [-(1:2)]))))     })     comp2 <- reactive({     plcomp2 <- eqcomp2(values$df_data [-(1:2)]))))     })      output$comp1 <- renderplot({     withprogress(message = 'plotting in progress ...', value = 0, {        (i in 1:15) {          incprogress(1/15)          sys.sleep(0.5)        }         plot( values@df_data[,1], comp1())      })     })     output$comp2 <- renderplot({     withprogress(message = 'plotting in progress ...', value = 0, {        (i in 1:15) {          incprogress(1/15)          sys.sleep(0.5)        }         plot( values@df_data[,1], comp2())      })     }) 

Comments