You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that this could be considered a bug but perhaps I'm just not understanding the way the callbacks should be used. Basically what happens is if you add both the resize method r2d3.onResize() and also a render method r2d3.onRender() and you have resized the viz then the next time you send new data that triggers onRender() it returns the old width, and height variables to its callback function.
Here's a gif of what I'm describing
Here's a shiny app that demos what I'm talking about in as little code as I could.
app.R
library(shiny)
ui<- fluidPage(
h3('To recreate bug'),
tags$ul(
tags$li('Note the size of viz provided by onRender()'),
tags$li('Resize the app and note the new size reported by onResize()'),
tags$li('Next press refresh button below. The size is not the new resized size, but the original onRender() size.')
),
actionButton('refresh', 'Refresh Viz'),
mainPanel( r2d3::d3Output("d3") )
)
server<-function(input, output) {
output$d3<-r2d3::renderD3({
input$refreshr2d3::r2d3(container='div', script="testing_bug.js")
})
}
shinyApp(ui=ui, server=server)
I believe that this could be considered a bug but perhaps I'm just not understanding the way the callbacks should be used. Basically what happens is if you add both the resize method
r2d3.onResize()
and also a render methodr2d3.onRender()
and you have resized the viz then the next time you send new data that triggersonRender()
it returns the oldwidth
, andheight
variables to its callback function.Here's a gif of what I'm describing
Here's a shiny app that demos what I'm talking about in as little code as I could.
app.R
And here's the r2d3 script:
testing_bug.js
Feel free to let me know if you need more info or if you have an idea of where I would dig to attempt to fix this myself.
Thanks!
The text was updated successfully, but these errors were encountered: