dygraphs
dygraphs copied to clipboard
Rstudio viewer and new window resizing
Hi, I'm trying to plot multiple charts in rstudio viewer using htmltools::browsable and tagList. The code is something like this.
htmltools::browsable( htmltools::tagList( dygraphs::dygraph(data, group = "test",height="250",width="95%",main="test"), dygraphs::dygraph(data1, group = "test", height = "200" ,width ="95%") ) )
This code works perfect in rstudio viewer, but when opened in the new window, it does not scale to fit the new window. Only the width works and thats probably because its in percentage terms. I tried changing the height to 50% for both graphs but it didnt work.
Any help on this would be greatly appreciated.
Could you please provide a Minimal Working Example (https://www.r-bloggers.com/writing-a-minimal-working-example-mwe-in-r/)?
Okay so basically this works, but it doesn't automatically resize when you open it in a new window.
data<-xts::xts(1:10, as.POSIXlt(1366039619, tz="GMT", origin="1970-01-01") + rnorm(10, 500000, 250000)/1000000) data1<-xts::xts(1:10, as.POSIXlt(1366039619, tz="GMT", origin="1970-01-01") + rnorm(10, 500000, 250000)/1000000) htmltools::browsable( htmltools::tagList( dygraphs::dygraph(data, group = "test",height="250",width="95%",main="test"), dygraphs::dygraph(data1, group = "test", height = "200" ,width ="95%") ) )
Perhaps specifying the height as a percentage will work, but this method doesnt :(
data<-xts::xts(1:10, as.POSIXlt(1366039619, tz="GMT", origin="1970-01-01") + rnorm(10, 500000, 250000)/1000000) data1<-xts::xts(1:10, as.POSIXlt(1366039619, tz="GMT", origin="1970-01-01") + rnorm(10, 500000, 250000)/1000000) htmltools::browsable( htmltools::tagList( dygraphs::dygraph(data, group = "test",height="50%",width="95%",main="test"), dygraphs::dygraph(data1, group = "test", height = "50%" ,width ="95%") ) )
I have a similar issue where fig.width, width and everything else has no effect in the notebook preview. The width is limited to a fixed value .
The problem seems to be from htmltools, not dygraph.
Minimal example:
htmltools::browsable(kable(mtcars, format="html"))