21
votes

When adding a ggvis plot to a shiny app, the width and height of the plot are fixed and don't automatically adjust to the size of the div the ggvis object is placed in. This obviously causes some problems when app users have different screen sizes for instance, or adjust the size of the app window.

It's possible to modify the size of the ggvis object on the server side using set_options, but this doesn't really help since I don't think there is a way to pass the size of the div to the server side.

I've tried modifying the css of the different classes associated with the ggvis object on the ui side (e.g. ggvis-output, ggvis-output-container, etc.) but this doesn't help either. The ggvisOutput function seems to override the css length and width no matter what.

Has anybody found a solution/workaround to dynamically resize a ggvis plot as function of the size of the surrounding div?

Thanks for your help.

1
Would that be aligned to this issue?hrbrmstr
Sort of. I'm not working with iframes, just the regular shiny layout, but I guess the problem is the same. It seems that I'll have to wait for ggvis developers to find the time to fix this.Simon Garnier

1 Answers

7
votes

This is now possible in the development version of ggvis. See https://github.com/rstudio/ggvis/pull/381