在闪亮的应用程序中动态调整ggvis图的大小

时间:2023-01-15 19:48:13

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.

将ggvis绘图添加到闪亮的应用程序时,绘图的宽度和高度是固定的,不会自动调整为放置ggvis对象的div的大小。当app用户具有不同的屏幕尺寸时,这显然会导致一些问题例如,或调整应用程序窗口的大小。

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.

可以使用set_options修改服务器端ggvis对象的大小,但这并没有真正帮助,因为我认为没有办法将div的大小传递给服务器端。

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.

我已经尝试修改与ui端的ggvis对象关联的不同类的css(例如ggvis-output,ggvis-output-container等),但这也无济于事。无论如何,ggvisOutput函数似乎都会覆盖css的长度和宽度。

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

有没有人找到一个解决方案/解决方法来动态调整ggvis图的大小作为周围div大小的函数?

Thanks for your help.

谢谢你的帮助。

1 个解决方案

#1


7  

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

现在可以在ggvis的开发版本中使用。请参阅https://github.com/rstudio/ggvis/pull/381

#1


7  

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

现在可以在ggvis的开发版本中使用。请参阅https://github.com/rstudio/ggvis/pull/381