R Brilliant application progress. Indicator for loading data.

Shiny is our in-house BI tool. For our brilliant applications, we load data before launching shinyServer:

load("afterProcessedData.RData")
# or dt = fread("afterProcessedData.csv")

shinyServer(function(input, output, session){ ...

However, some applications download large files, and they load up to 30 seconds. Many users, when opening a page, do not know if the page is damaged because it is stuck at loading. They may close it or click filters, which may lead to an error. In this case, the progress indicator will be very useful. I notice that it withProgress()can help, but it should be inside reactive()or renderXx().

One way I can do this laod()is based on reactive()internally shinyServer(function(input, output, session){, but I'm worried that this will slow down performance. And my users really care about agile performance.

Any suggestions for this situation?

Edit: I think there is no easy way to do this. I have another thought. Maybe I can show the text on the screen saying "data is loading", but I should make it disappear after the first table appears. However, I do not know how to adjust the condition. Below my code shows the first table:

dashboardBody(
fluidRow( 
  tabBox(width = 12,
         tabPanel("Summary",
                  dataTableOutput("data1")),

Thank you in advance!

+4
source share
2 answers

, load(), , . , " ..." , .

#server.R   firstData is a reactive function to get the data for 1st table
  output$firstTable = reactive({
return(is.null(firstData()))
})
#ui.R
      conditionalPanel(
    condition = "output.firstTable",
    box(width = 12,
           h1("The data is loading...")
        )
  )
+3

@user5249203, withSpinner() shinycssloaders. , , CRAN : https://andrewsali.shinyapps.io/example/

0

Source: https://habr.com/ru/post/1628011/


All Articles