user3022875
user3022875

Reputation: 9018

Invalidate Later in 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.

Upvotes: 4

Views: 1847

Answers (1)

John Paul
John Paul

Reputation: 12654

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.

Upvotes: 9

Related Questions