-
-
Save McClellandLegge/6a054593de5c3237c02f7936b8f2bc96 to your computer and use it in GitHub Desktop.
"Calculation In Process..." busy indictor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyServer(function(input, output) { | |
output$obs <- renderUI({ | |
sliderInput("obs", "Number of observations:", | |
min = 10000, max = 90000, | |
value = 50000, step = 10000) | |
}) | |
output$distPlot <- renderPlot({ | |
if (!is.null(input$obs)) { | |
dist <- NULL | |
for (i in 1:input$obs) { | |
dist <- c(dist, rnorm(1)) | |
} | |
hist(dist, breaks = 100) | |
} | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyUI(bootstrapPage( | |
# Add custom CSS & Javascript; | |
tagList( | |
tags$head( | |
tags$link(rel="stylesheet", type="text/css",href="style.css"), | |
tags$script(type="text/javascript", src = "busy.js") | |
) | |
), | |
div(class = "busy", | |
p("Calculation in progress.."), | |
img(src="http://imageshack.us/a/img827/4092/ajaxloaderq.gif") | |
), | |
div(class = "span4", uiOutput("obs")), | |
div(class = "span8", plotOutput("distPlot")) | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setInterval(function(){ | |
if ($('html').attr('class')=='shiny-busy') { | |
setTimeout(function() { | |
if ($('html').attr('class')=='shiny-busy') { | |
$('div.busy').show() | |
} | |
}, 1000) | |
} else { | |
$('div.busy').hide() | |
} | |
}, 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div.busy { | |
position:absolute; | |
top: 40%; | |
left: 50%; | |
margin-top: -100px; | |
margin-left: -50px; | |
display:none; | |
background: rgba(230, 230, 230, .8); | |
text-align: center; | |
padding-top: 20px; | |
padding-left: 30px; | |
padding-bottom: 40px; | |
padding-right: 30px; | |
border-radius: 5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment