我想禁用 http://christophergandrud.github.io/d3Network/上提供的网络图中的鼠标悬停效果(搜索"放大"(。 即使没有本机选项,我想也可以通过使用htmltools
或htmlwidget
插入适当的javascript函数(例如 http://bl.ocks.org/PandaRider/84b9c096e37334c2a4fd945a66b8ccf9(来实现。
更新: 刚刚注意到烦人的效果显示在Chrome中而不是Edge中。
它不受"本机"支持,但您可以使用htmlwidgets::onRender
来实现这一点......
对于forceNetwork()
:
library(networkD3)
library(htmlwidgets)
data(MisLinks)
data(MisNodes)
fn <- forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group")
onRender(fn, "function(el,x) { d3.selectAll('.node').on('mouseover', null); }")
对于diagonalNetwork()
和radialNetwork()
:
library(networkD3)
library(htmlwidgets)
URL <- paste0("https://cdn.rawgit.com/christophergandrud/networkD3/",
"master/JSONdata//flare.json")
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
Flare$children = Flare$children[1:3]
rn <- radialNetwork(List = Flare, fontSize = 10, opacity = 0.9)
onRender(rn, "function(el, x) { d3.selectAll('.node').on('mouseover', null); }")
dn <- diagonalNetwork(List = Flare, fontSize = 10, opacity = 0.9)
onRender(dn, "function(el, x) { d3.selectAll('.node').on('mouseover', null); }")