0

I have created a fairly large (multi-page) flexdashboard that includes different htmlwidgets (plotly, highcharts, leaflet, etc).

In order to avoid conflict between rCharts and other htmlwidgets, I included the javascript libraries mannually, excluding jQuery:

<link rel='stylesheet' href=C:/Users/stefanj/Documents/R/win-library/3.3/rCharts/libraries/nvd3/css/nv.d3.css>
  <link rel='stylesheet' href=C:/Users/stefanj/Documents/R/win-library/3.3/rCharts/libraries/nvd3/css/rNVD3.css>
  <script type='text/javascript' src=C:/Users/stefanj/Documents/R/win-library/3.3/rCharts/libraries/nvd3/js/d3.v3.min.js></script>
  <script type='text/javascript' src=C:/Users/stefanj/Documents/R/win-library/3.3/rCharts/libraries/nvd3/js/nv.d3.min-new.js></script>
  <script type='text/javascript' src=C:/Users/stefanj/Documents/R/win-library/3.3/rCharts/libraries/nvd3/js/fisheye.js></script> 

Also, I set the rChart chunk to:

```{r, echo=FALSE,results='asis', eval = TRUE, include_assets = FALSE}

However, when I plot a simpleNetwork, it does not render if the rCharts are included in the flexboard.

Any ideas?

P.S. not sure what else to include to make the question more reproducible.

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56
Prometheus
  • 1,977
  • 3
  • 30
  • 57
  • To have a _reproducible_ question try to use know and simple data sets like `iris` and find a simple combination of widgets which reproduce the problem. Not sure if this rcharts work nice with rest of htmlwidgets, have you tried highcharter instead? – jbkunst Jul 05 '17 at 14:30
  • yes. i actually use it in one of the charts. but i haven't really found anything as interactive as http://nvd3.org/examples/multiBar.html – Prometheus Jul 05 '17 at 14:34
  • All depends what you define interactive ;)! – jbkunst Jul 05 '17 at 19:24

1 Answers1

2

networkD3 was updated to D3v4 in version 0.3 in. Feb. 2017, which is not compatible with v3 versions of D3, which is what rCharts appears to use. htmlwidgets, which is the underlying package that drives networkD3 and rCharts, only uses the most recent version of a dependency, so htmlwidgets that use conflicting versions of the same library can not both work. Check here for a starting point of discussion about this problem.

You have a few possible options, though none of them are great...

  1. revert networkD3 to a version < 0.3 so that it also uses D3v3

  2. lobby for the rCharts developers to upgrade to D3v4

  3. lobby for the htmlwidgets` developers to come up with a robust way of dealing with conflicting JavaScript dependencies

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56