【问题标题】:Extend time progress bar displays message延长时间进度条显示信息
【发布时间】:2015-10-13 16:12:42
【问题描述】:

有没有办法延长进度条消息的显示时间?说延长它以使其发布大约 1.5 秒?

【问题讨论】:

  • 你能给出你的代码的reproducible example,显示你的问题吗?我不太清楚你想要达到什么目标。

标签: r shiny


【解决方案1】:

您可以使用 shinyIncubator 包中的功能。根据您的示例,我将sleep 设置为 1.5 秒,因此当任务完成后,消息将保持可见 1.5 秒。

rm(list = ls())
library(shiny)
library(shinyIncubator)

server <- function(input, output, session) {
  observe({
    if(input$aButton==0) return(NULL)
    withProgress(session, min=1, max=15, expr={
      for(i in 1:10) {
        setProgress(message = 'Finished...',detail = paste0('Number ',i, ':10'))
        Sys.sleep(0.1)
      }
      Sys.sleep(1.5)
    })
  })
}

ui <- pageWithSidebar(
  headerPanel("Testing"),
  sidebarPanel(actionButton("aButton", "Let's go!"), width=2),
  mainPanel(progressInit())
)

shinyApp(ui = ui, server = server)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多