networkD3 与 rCharts 冲突

networkD3 conflict with rCharts

我创建了一个相当大的(多页)flexdashboard,其中包含不同的 htmlwidgets(plotly、highcharts、leaflet 等)。

为了避免 rCharts 和其他 htmlwidgets 之间的冲突,我手动包含了 javascript 库,不包括 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> 

此外,我将 rChart 块设置为:

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

但是,当我绘制一个简单网络时,如果 rCharts 包含在 flexboard 中,它不会呈现。

有什么想法吗?

P.S。不确定还包括什么以使问题更可重现。

networkD3 已在 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 中更新为 D3v4,作为讨论此问题的起点。

您有几个可能的选择,尽管其中 none 很棒...

  1. networkD3 还原为 < 0.3 版本,以便它也使用 D3v3

  2. rCharts developers 升级到 D3v4 的大厅

  3. 游说 htmlwidgets` developers 想出一个强大的方法来处理冲突的 JavaScript 依赖关系