I am updating a text output in shiny every second which is read from a sql database and it just takes some time. In the dashboard I just want to see how the output changes without the fancy animation / flickering. Is there away to remove the animation and just display the text while it waits for the update?
Here is some Code Example in which you can see the flickering of the update:
# ui.R
library(shiny)
shinyUI(fluidPage(
# App title ----
titlePanel("Title"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(),
# Main panel for displaying outputs ----
mainPanel(
# Output: Data file ----
# Output: Tabset w/ plot, summary, and table ----
tabsetPanel(type = "tabs",
tabPanel("Main",
textOutput("foo"))
)
)
)
)
)
# server.R
library(shiny)
check_for_update <- function() {
Sys.time()
}
get_data <- function() {
df <- data.frame(replicate(20000,sample(0:1000,rep=TRUE)))
}
shinyServer(
function(input, output, session) {
# checks for new data every 1 seconds
data <- reactivePoll(50, session,
checkFunc = check_for_update,
valueFunc = get_data)
# the outputs will only be refreshed in case the data changed
output$foo <- renderText({
df <- data()
df[[2]]
})
}
)
Thanks in advance!