我想禁用http://christophergandrud.github.io/d3Network/上提供的网络图中的鼠标悬停效果(搜索“放大”)。
即使没有本机选项,我想也可以通过使用htmltools
或htmlwidget
插入适当的javascript函数(例如http://bl.ocks.org/PandaRider/84b9c096e37334c2a4fd945a66b8ccf9)来实现。
更新: 只是注意到,令人讨厌的效果显示在Chrome中,而不是在Edge中。
答案 0 :(得分:1)
“本机”不支持该功能,但是您可以使用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); }")