【问题标题】:shiny add Progress bar with source() function闪亮的使用 source() 函数添加进度条
【发布时间】:2016-02-07 17:10:11
【问题描述】:

在我闪亮的应用程序开始时,我运行一个源函数来加载和处理我的数据。

一切正常,但是当用户启动应用程序时,加载时间大约为 10 秒。我想添加一个进度条。

我看过教程,但总是与观察或反应功能集成,这不是我的情况。

shinyServer(function(input, output,session) {
  source("/srv/shiny-server/Data_base/import.r")    
})

如何添加进度条?

【问题讨论】:

    标签: r progress-bar shiny


    【解决方案1】:

    也许这个链接有帮助:https://github.com/daattali/shiny-server/blob/master/loading-screen/app.R

    基本上你应该在反应内容之外添加这段代码:

     appCSS <- "
    #loading-content {
      position: absolute;
      background: #000000;
      opacity: 0.9;
      z-index: 100;
      left: 0;
      right: 0;
      height: 100%;
      text-align: center;
      color: #FFFFFF;
    }
    "
    

    这个到ui端:

    useShinyjs(),
    inlineCSS(appCSS),
    
    # Loading message
    div(
      id = "loading-content",
      h2("Loading...")
    ),
    

    这到服务器端(将在内容加载后隐藏“加载”消息:

     hide(id = "loading-content", anim = TRUE, animType = "fade") 
    

    【讨论】:

    猜你喜欢
    • 2018-09-14
    • 2019-01-20
    • 2017-11-08
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 2018-05-29
    • 1970-01-01
    • 2020-06-12
    相关资源
    最近更新 更多