Closed higor-gomes93 closed 2 years ago
This works for me...
library(networkD3)
library(htmlwidgets)
net <- forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity = 1, fontSize = 24,
fontFamily = "helvetica", opacityNoHover = 1)
customJS <-
'function() {
d3.selectAll(".node text").attr("stroke-width", ".5px").attr("stroke", "#fff");
}'
htmlwidgets::onRender(net, customJS)
can you provide a minimal reproducible example to demonstrate the problem you're having?
That really worked for me, cjyetman! Thank you very much. Any clues on how to change de text colour inside the customJS function?
I don't know for sure the attribute or CSS names and values off the top of my head, but you can add more commands like
.attr("font-color", "blue")
or
.style("font-color", "blue")
to the existing chain above
Hi! I'm having trouble with my nodes labels. Nodes and nodes labels have the same colors when using forceNetwork. This was addressed in this issue , but I couldn't solve my problem. Any thoughs on how to solve this?