christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
652 stars 268 forks source link

resize doesn't work when switching tabs in flexdashboard #145

Open voxnonecho opened 8 years ago

voxnonecho commented 8 years ago

Same issue as #133 but for radialNetwork() and related to this

christophergandrud commented 7 years ago

Sorry for the delay.

Is this still a problem, if so can you provide a simple reproducible example?

cjyetman commented 7 years ago

I think I have a minimal reproducible example of this. Save this as an .Rmd

---
title: "radial in flex dashboard"
author: "CJ Yetman"
output: 
  flexdashboard::flex_dashboard:
    mathjax: null
---

```{r setup, include=FALSE}
library(flexdashboard)
library(networkD3)

URL <- paste0("https://cdn.rawgit.com/christophergandrud/networkD3/master/JSONdata//flare.json")
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
s1 <- radialNetwork(List = Flare, fontSize = 10, opacity = 0.9)
```

Page 1
==================
```{r}
s1
```

Page 2
==================
```{r}
s1
```

then "Knit to flex_dashboard" and the radial plot on Page 2 is zoomed in really far. Is this the behavior you were talking about @voxnonecho? I wouldn't call that "Can't render radialNetwork() in flexdashboard", but based on the other issues you pointed to, that seems like the issue you were talking about.

cjyetman commented 7 years ago

treeNetwork now supersedes diagonalNetwork, dendroNetwork, and radialNetwork, but this issue still exists. new example...

---
title: "radial in flex dashboard"
author: "CJ Yetman"
output: 
  flexdashboard::flex_dashboard:
    mathjax: null
---

```{r setup, include=FALSE}
library(flexdashboard)
library(networkD3)

URL <- paste0("https://cdn.rawgit.com/christophergandrud/networkD3/master/JSONdata//flare.json")
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
s1 <- treeNetwork(Flare, direction = 'radial')

Page 1

s1

Page 2

s1
cjyetman commented 7 years ago

changed title to better reflect the issue