更改withProgress()生成的消息框的样式

时间:2015-04-13 19:57:14

标签: r shiny

withProgress()函数可以生成一个消息框,指示闪亮的应用程序正在运行。但是消息是在浏览器的右上方,文本大小很小,这使得消息不那么引人注目。所以我想知道是否有任何方法可以改变这个盒子的风格,这样消息可以更具表现力。

4 个答案:

答案 0 :(得分:5)

您可以使用CSS(add it to your header or load css from a location on the server(www文件夹))更改闪亮进度条的外观(字体,颜色等)和位置。

另请参阅:this post from back when shiny was still new ... 我相信.shiny-progress CSS类仍然适用。 CSS类更改为.shiny-progress-container

答案 1 :(得分:2)

在Shiny的较新版本上,进度条显示在闪亮通知上,您可以使用function um_post_registration( $user_id, $args ){ global $ultimatemember; unset( $args['user_id'] ); extract($args); do_action("um_post_registration_global_hook", $user_id, $args); ////////////////code I added///////////////// if ( isset( $args['etablissement'] ) ) { global $wpdb; $res = $wpdb->get_var( $wpdb->prepare("SELECT DOMAINE_ETABLISSEMENT FROM etablissements WHERE CODE_ETABLISSEMENT = %s ", $args['etablissement'])); $regex='/.*' . $res . '$/'; if(preg_match($regex, $args['user_email'])){ update_user_meta( $user_id, 'account_status', 'approved'); um_fetch_user($user_id); } } $status = um_user('status'); ////////////end of added code////////////// do_action("um_post_registration_{$status}_hook", $user_id, $args); ... Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. "jest": "20.0.4" "react-native": "0.47.1" "react": "16.0.0-alpha.12" "react-relay": "^1.1.0" 内部{类似}来修改以下CSS类的样式includeCSS()):



ui.r




答案 2 :(得分:2)

更多细节: 您可以在ui中包含HTML函数标记$ head()以覆盖进度条。因为,如上所述,它是一个通知,可以通过.shiny-notification调用它。最简单的方法是将此行放在ui中的某个位置并调整位置(以及其他与CSS相关的参数see here

[PSCustomObject]

答案 3 :(得分:0)

我不能从这里的答案中弄清楚,但是this问题中提供的更完整的答案使我明白了:

library(shiny)

ui <- fluidPage(
  tags$head(tags$style(
      HTML(".shiny-notification {position:fixed;top: 30%;left: 0%;right: 0%;}"))),
  actionButton(inputId = "go", label = "Launch long calculation")
)

server <- function(input, output, session) {
  observeEvent(input$go,{
    withProgress(message = "doing task 1",value = 0,{
      Sys.sleep(1.5)#task 1
      setProgress(0.3,message = "doing task 2",detail = "\n task 1 done")
      Sys.sleep(1.5)#task 2
      setProgress(0.6,message = "doing task 3",detail = "\n task 1 done \n task 2 done")
      Sys.sleep(1.5)#task 3
      setProgress(0.9,message = "Almost done",detail = "\n task 1 done \n task 2 done \n task 3 done")
      Sys.sleep(1.5)
    })
  })
}

shinyApp(ui, server)