Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalidate Later in Shiny

Tags:

r

shiny

I am using

invalidateLater(5000, session)

in my Shiny code and it is working. Every 5 seconds I have a query that is refreshed and a plot is updated. BUT the screen and plots go GRAY every 5 seconds so it looks like the page is dead while the updating occurs. Is there a way to make ONLY the plots update and have the page avoid looking like it's dead?

@JOhn - THank you here is my ui.r

shinyUI(pageWithSidebar(
  headerPanel("tst"),
  sidebarPanel(
    sliderInput("n", "Number of plots", value=2, min=1, max=7),
    width = 2
  ),
  mainPanel(
    # This is the dynamic UI for the plots
    uiOutput("plots")

  )
))

Thank you.

like image 368
user3022875 Avatar asked Jan 10 '23 01:01

user3022875


1 Answers

The issue is that when something is being updated, the default .css gives it a class of .recalculating and that is what makes it look gray. You can fix this by putting

tags$style(type="text/css",
  ".recalculating { opacity: 1.0; }"
)

in your ui.r or putting the equivalent in you .css ifyou are using one. Obviously, if you know CSS you can experiment with other ideas as well.

like image 52
John Paul Avatar answered Jan 11 '23 19:01

John Paul