shiny radial progress

733 views
Skip to first unread message

Matthias Wendel

unread,
Oct 6, 2014, 6:29:04 AM10/6/14
to shiny-...@googlegroups.com
Hi,
is there a way to use radial progress bars in shiny? That would be useful in cases where there is no way to estimate the length of an execution. If not, are you planning to include this possibility?
Thanks,
Matthias

Winston Chang

unread,
Oct 7, 2014, 11:42:44 AM10/7/14
to Matthias Wendel, shiny-discuss
Hi Matthias - 

There isn't a simple way to do this right now, but it sounds like a good idea. (I assume you've read the Progress bar article here: http://shiny.rstudio.com/articles/progress.html.)

I've filed an issue for it here:

Right now you have a few options:

* Increment the progress bar asymptotically. For example, you can move it by 10% of the remaining distance each time.

* You can use a progress bar that's simply set to 100%. The progress bars are striped and always move, but the stripes are pretty subtle. The example below sets the progress bar to 100% and uses customized CSS to make the stripes more visible. The CSS is modified from the Bootstrap 2 progress bar CSS to have more opaque white overlays:

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)


-Winston


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/bcc5b11b-e135-4f89-beaa-6e9f4960b7e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages