rstudio / dygraphs

R interface to dygraphs
http://rstudio.github.io/dygraphs
Other
365 stars 194 forks source link

shinydashboard menuitem plus dygraph refresh issue #82

Open Stephen-McDaniel opened 9 years ago

Stephen-McDaniel commented 9 years ago

Hi JJ and team,

When using shinydashboard_0.5.0 menuItem feature with leaflet, dygraph (used latest build from Github) and ggvis output the dygraph output isn't updating in the following scenario.

1) Go to a menuItem that isn't dygraph 2) Filter the reactive data source using an input (selectInput for example) 3) Return to dygraph menuItem. It shows a blank with the range selector in the upper left (see image).

dygraph

4) Both leaflet and ggvis objects update even though I am on different menuItems when I filter. 5) If I remain on the dygraph menuItem, the chart updates from this "empty" state if I change any filter item for the reactive data source.

This may be a matter of not understanding an option or feature (I tried outputOptions(output, 'dygraphUI', suspendWhenHidden=FALSE) .)

Thanks, Stephen

jjallaire commented 9 years ago

@jcheng5 and @wch Is this another variation of the same issue that we saw in ioslides? (where we had to expressly trigger a dygraphs resize event when slides changed). Recall that at the R summit Bryan Lewis mentioned that he had a similar issue and we thought there might be a more generic way to make sure this never happened to widgets (i.e. each widget author shouldn't have to implement the same hack, e.g. https://github.com/rstudio/dygraphs/blob/9cb00780b46dcf3e3d70e54c7cb45508d071f70b/inst/htmlwidgets/dygraphs.js#L103-L110)

jcheng5 commented 9 years ago

I wouldn't expect so, if shown/hidden events are being triggered by shinydashboard when the different menu items are selected. @wch can you confirm that this is the case?

wch commented 9 years ago

I'm pretty sure that the shown/hidden events are triggered when different menuItems are selected. @Stephen-McDaniel can you provide a simple reproducible example?

Stephen-McDaniel commented 9 years ago

Hi Winston,

I have built a fairly comprehensive example, but have been unable to reproduce the problem seen in the higher complexity environment.

Is there a menuitem trigger event (input) I can throw into the dygraphs reactive data source chain to force a trivial update as a workaround?

Thanks for you help! Stephen