Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3heatmap does not render in flexdashboard when scatterD3 also used #77

Open
andreamrau opened this issue Nov 29, 2016 · 4 comments
Open

Comments

@andreamrau
Copy link

Hello,
I'm currently working on a flexdashboard in which I would like to include both a d3heatmap and a scatterD3. When d3heatmap is used by itself, it renders just fine; however, when both are present the d3heatmap does not render (regardless of whether the chunk is placed first or last). The same problem occurs in rmarkdown. Minimal reproducible example below, thanks!
-- Andrea

---
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
runtime: shiny
---

```{r global, include=FALSE}
library(flexdashboard)
library(d3heatmap)
library(scatterD3)
data(mtcars)
```

scatterD3
=====================================
Renders fine.

```{r, scatterD3, eval=FALSE}
scatterD3(data = mtcars, x = wt, y = mpg, 
          point_size = 100, point_opacity = 0.5,
          hover_size = 4, hover_opacity = 1)
```

d3heatmap
===================================== 
Does not render (unless chunk above set to eval=FALSE)!

```{r, d3heatmap}
d3heatmap(mtcars, scale="column", colors="Blues")
```
@andreamrau
Copy link
Author

Actually, I see that d3heatmap seems to work just fine in flexdashboard in tandem with plotly and metricsgraphics, so this may be an issue for scatterD3 instead.

@ThomasSiegmund
Copy link

This happens because scatterD3 uses D3.js version 4.x,, while d3heatmap uses version 3.x. If both widgets are in the same page, htmlwidgets loads only the latest D3 version, 4.x. This leaves d3heatmap broken. There are two options: either d3heatmap is upgraded to D3 version 4, or scatterD3 uses a custom bundle of D3 in an own namespace.

@jcheng5
Copy link
Collaborator

jcheng5 commented Apr 26, 2017

Shoot. I think d3 v3 and d3 v4 can actually exist side-by-side, but, because they use the same name "d3" htmltools/htmlwidgets assumes that they are substitutes. One fix would be to change the name of the latter to d3v4, but that's something that everyone that bundles d3 v4 would have to standardize on.

Another possibility would be for scatterD3 to "compile in" its copy of d3 v4 using browserify or webpack--it was my understanding that this is how d3 v4 was designed to be used. If that was the case then there would be no separate d3 dependency at all for d3 v4.

@amandamasonsingh
Copy link

amandamasonsingh commented Sep 20, 2017

I have this same issue (i.e., the d3heatmap image will not render - however the title of the heat map does render) when using both the networkD3 and d3heatmap packages in an R Shiny app.

Are there plans to fix this issue (assuming the problem is due to d3heatmap using an older version of D3.js, whereas other packages are using newer/the most recent version of D3.js)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants