Shiny: λΆˆν™•μ‹€ν•œ μ‹œκ°„μ— λŒ€ν•œ 진행λ₯  ν‘œμ‹œμ€„

에 λ§Œλ“  2014λ…„ 10μ›” 07일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: rstudio/shiny

λ•Œλ‘œλŠ” μ‹€ν–‰ μ‹œκ°„μ„ μ˜ˆμΈ‘ν•  수 μžˆλŠ” 방법이 μ—†μŠ΅λ‹ˆλ‹€. μ΄λŸ¬ν•œ 경우 λ°©μ‚¬ν˜• 진행λ₯  ν‘œμ‹œκΈ° λ˜λŠ” μ›€μ§μ΄λŠ” ν•΄μΉ˜ λ§‰λŒ€κ°€ 있으면 μœ μš©ν•©λ‹ˆλ‹€.
https://groups.google.com/d/msg/shiny-discuss/a3TcQ2C_hS0/3H4zocpRD0AJ

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

또 λ‹€λ₯Έ κ°€λŠ₯성은 λ‹¨μˆœνžˆ μ€„λ¬΄λŠ¬λ₯Ό 더 잘 보이게 λ§Œλ“€κ³  진행λ₯  값을 1둜 μ„€μ •ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€.

server <- function(input, output) {
  output$plot <- renderPlot({
    input$goPlot # Re-run when button is clicked

    dat <- data.frame(x = rnorm(10), y = rnorm(10))

    withProgress(message = 'Making plot', value = 1, {
      Sys.sleep(20)
    })

    plot(dat$x, dat$y)
  })
}

ui <- shinyUI(basicPage(
  tags$head(tags$style(HTML("
    .progress-striped .bar {
      background-color: #149bdf;
      background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.6)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.6)), color-stop(0.75, rgba(255, 255, 255, 0.6)), color-stop(0.75, transparent), to(transparent));
      background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      -webkit-background-size: 40px 40px;
         -moz-background-size: 40px 40px;
           -o-background-size: 40px 40px;
              background-size: 40px 40px;
    }
  "))),
  plotOutput('plot', width = "300px", height = "300px"),
  actionButton('goPlot', 'Go plot')
))

shinyApp(ui = ui, server = server)

λͺ¨λ“  3 λŒ“κΈ€

또 λ‹€λ₯Έ κ°€λŠ₯성은 λ‹¨μˆœνžˆ μ€„λ¬΄λŠ¬λ₯Ό 더 잘 보이게 λ§Œλ“€κ³  진행λ₯  값을 1둜 μ„€μ •ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€.

server <- function(input, output) {
  output$plot <- renderPlot({
    input$goPlot # Re-run when button is clicked

    dat <- data.frame(x = rnorm(10), y = rnorm(10))

    withProgress(message = 'Making plot', value = 1, {
      Sys.sleep(20)
    })

    plot(dat$x, dat$y)
  })
}

ui <- shinyUI(basicPage(
  tags$head(tags$style(HTML("
    .progress-striped .bar {
      background-color: #149bdf;
      background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.6)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.6)), color-stop(0.75, rgba(255, 255, 255, 0.6)), color-stop(0.75, transparent), to(transparent));
      background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.6) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.6) 75%, transparent 75%, transparent);
      -webkit-background-size: 40px 40px;
         -moz-background-size: 40px 40px;
           -o-background-size: 40px 40px;
              background-size: 40px 40px;
    }
  "))),
  plotOutput('plot', width = "300px", height = "300px"),
  actionButton('goPlot', 'Go plot')
))

shinyApp(ui = ui, server = server)

μœ„μ˜ μ œμ•ˆμ„ λ°›μ•„ λ³΄λ €κ³ ν–ˆμ§€λ§Œ ... μž‘λ™ν•˜μ§€ μ•ŠλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€ ...

λ‚΄ μ‹œλ„μ— λŒ€ν•΄ μ•„λž˜λ₯Ό μ°Έμ‘°ν•˜μ‹­μ‹œμ˜€. 도움을 μ£Όμ‹œλ©΄ κ°μ‚¬ν•˜κ² μŠ΅λ‹ˆλ‹€.

http://stackoverflow.com/questions/38339593/shiny-loading-bar-for-htmlwidgets

μ΄λŸ°κ²ƒλ„ μ¨λ„λ κΉŒμš”...?

https://gist.github.com/eesur/cf81a5ea738f85732707

https://getbootstrap.com/docs/3.4/components/#progress -animatedλ₯Ό μ‚¬μš©ν•  수 μžˆλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.

@jcheng5 λŠ” value = NA λ₯Ό μ„€μ •ν•˜μ—¬ "λΆˆν™•μ • λͺ¨λ“œ"λ₯Ό ν™œμ„±ν™”ν•  것을 μ œμ•ˆν–ˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ 이것이 "μ• λ‹ˆλ©”μ΄μ…˜"이라고 ν•˜λŠ” 경우 animated λ§€κ°œλ³€μˆ˜λ₯Ό μΆ”κ°€ν•˜λŠ” 것이 더 μœ μ—°ν•  수 μžˆμœΌλ―€λ‘œ withProgress(..., value = 1, animate = TRUE)

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰