App with spinner

Hello everyone, I'm wondering if someone could help me with the way a spinner is displaying in my app. The problem is that the spinner appears in the app as soon as I launch the app, which is not my intention. The spinner is supposed to appear only when the make plot button is clicked.

I also wonder if there is a way to display a message with the spinner, like Generating plot, please wait.

Below I attach the app in order to replicate what is happneing with it.

Thanks in advance !!


ui <- fluidPage(
      selectInput(inputId = "selectVar", label = "Select variable",
                  choices = c("var1", "var2")),
      checkboxInput(inputId = "bootstrap", label = "Perform bootstrap", value = F),
      conditionalPanel(condition = "input.bootstrap == true",
                       sliderInput(inputId = "slider1", label = "Select sample size for bootstrap",
                                   min = 1000, max = 50000, value = 5000, step = 1000 )),
      actionButton(inputId = "boton1", label = "Make plot")
      tabPanel(title = "tab1",
               withSpinner(plotOutput(outputId = "CyF"),
                           type = getOption("spinner.type", default = 4), hide.ui = T))

server <- function(input, output, session) {
  data <- reactive({
    var1 <- rnorm(1000, 0, 1)
    var2 <- rnorm(1000,10,5)
    cbind(var1, var2)
  observeEvent(input$boton1, { 
    output$CyF <- renderPlot({
      } else {
        descdist(data()[,isolate(input$selectVar)], boot = isolate(input$slider1))

shinyApp(ui = ui, server = server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.