(관련 탭하지만, 탭 세트 위에뿐만 아니라) 나뿐만 아니라이 찾고 있었어요. 대부분의 사람들은 조건부 패널과 같이 제안한다
conditionalPanel(
condition="!($('html').hasClass('shiny-busy'))",
img(src="images/busy.gif")
)
당신은 항상 당신의 ui.R이 같은 조건 처리 (어쩌면 더 많은 물건에 따라) 자신에게 더 많은 제어를 제공하고 만들 수 있습니다
div(class = "busy",
p("Calculation in progress.."),
img(src="images/busy.gif")
)
일부 자바 스크립트가 DIV의 표시 및 숨기기 처리 여기서 몇 가지 추가 CSS로
setInterval(function(){
if ($('html').attr('class')=='shiny-busy') {
$('div.busy').show()
} else {
$('div.busy').hide()
}
},100)
을 당신은 당신의 애니메이션 바쁜 이미지가 고정 된 위치보다 어디를 얻을 수 있는지 확인 할 수 그것은 항상 보일 것입니다.
"반짝 반짝 빛나는"상태가 다소 부정확하고 신뢰할 수 없다는 것을 발견했습니다. div가 초 단위로 표시되고 계산이 진행되는 동안 사라집니다. 더러운 솔루션을 발견했습니다. 적어도 내 애플 리케이션에서 그 문제를 해결하기 위해. 시험해보고 자유롭게 사용해보십시오. 누군가가 어떻게 그리고 왜 이것이 문제를 해결하는지에 대한 통찰력을 줄 수 있습니다. (또는 계산이 갈 다른 출력 기능), 당신이를 재설정 이러한 반응 값을 사용하여 renderPlot 기능에 다음
shinyServer(function(input, output, session) {
# Reactive Value to reset UI, see render functions for more documentation
uiState <- reactiveValues()
uiState$readyFlag <- 0
uiState$readyCheck <- 0
: 당신의 server.R에서
두 reactiveValues를 추가해야합니다 기능 :
output$plot<- renderPlot({
if (is.null(input$file)){
return()
}
if(input$get == 0){
return()
}
uiState$readyFlag
# DIRTY HACK:
# Everytime "Get Plot" is clicked we get into this function
# In order for the ui to be able show the 'busy' indicator we
# somehow need to abort this function and then of course seamlessly
# call it again.
# We do this by using a reactive value keeping track of the ui State:
# renderPlot is depending on 'readyFlag': if that gets changed somehow
# the reactive programming model will call renderPlot
# If readyFlag equals readyCheck we exit the function (= ui reset) but in the
# meantime we change the readyFlag, so the renderHeatMap function will
# immediatly be called again. At the end of the function we make sure
# readyCheck gets the same value so we are back to the original state
isolate({
if (uiState$readyFlag == uiState$readyCheck) {
uiState$readyFlag <- uiState$readyFlag+1
return(NULL)
}
})
isolate({plot <- ...})
# Here we make sure readyCheck equals readyFlag once again
uiState$readyCheck <- uiState$readyFlag
return(plot)
})
링크가 죽었습니다 ... –