Does shiny only compute when the output object is viewed?

shiny

#1

Hi everyone,

I am making a shiny app. On the sidebar panel I set up an action button to draw a plot and on the main panel, I create a tabset panel(the user has to click the plot tabset pannel to view it) to show the plot. However, what I found is when I click the action button, shiny would not start drawing the plot until specifically open the tabset panel. The way I enable the action button is with observeEvent. Is this normal?

To illustrate my point more clearly, here is a screen shot of my app.


#2

Hi @trcc light_smile:

I think I saw in a video (probably this one but I can't rewatch it right now..) that Joe Cheng said shiny only renders outputs that are seen. I recommend this video and the second part anyway. It's really informative! :smile:

Good luck!
Praer


#3

Thank you Praer! I really wish shiny has a way that allows me to force the execution of the plot:grin:


#4

I make another element dependent on the plot data (such as text summary) that you can hide in the footer, then Shiny will execute to show that element, and its ready for when users click over to the tab.


#5

@trcc

Look at ?outputOptions. That's what you need.

outputOptions(output, "myplot", suspendWhenHidden = FALSE)