I have been able to get an r2d3 visual to resize the width automatically but nothing is working in terms of resizing the height e.g. when changing to a bigger screen.
tagList(
mainPanel(width="100%",
tags$div(
id = "result-block",
d3Output(ns("d3Plot")
,width = "100%" ,height = "750px"
))
,actionButton("go", "Take a screenshot")
)
) #End of tagList
}
#' r2d3 Server Functions
#'
#' @noRd
mod_r2d3_server <- function(id){
moduleServer( id, function(input, output, session){
ns <- session$ns
nodes <- read.csv("inst/app/data/NodesNew.csv")
edges <- read.csv("inst/app/data/Edges.csv")
map_list <- list(nodes = nodes,links = edges)
data <- toJSON(map_list)
#Send that json from the session to our javascript
session$sendCustomMessage(type="jsondata",data)
plotInput <- function(){
data<-data
r2d3(css="inst/app/data/net.css", data=data, script = "inst/app/www/net.js", d3_version = "4",sizingPolicy(padding = 0, browser.fill = TRUE,viewer.fill=TRUE))
}
output$d3Plot<-renderD3({
print(plotInput())
})
})
}
How can I get it to resize automatically? r2d3 is supposed to handle this automatically from everything I've read but it does not work for me. Would appreciate any help with this!