I'm currently trying to build a force directed graph with d3js v4. I have the following nodes and links, actually pretty simple
nodes
[
{
"id":"4d2b0275-5bc7-e611-81c4-00155df7ea33"
},{
"id":"b32b0275-5bc7-e611-81c4-00155df7ea33"
}
]
links
[
{
"source":"4d2b0275-5bc7-e611-81c4-00155df7ea33",
"target":"b32b0275-5bc7-e611-81c4-00155df7ea33"
}
]
my forceSimulation setup is
var simulation = d3.forceSimulation(nodes)
.force("charge", d3.forceManyBody())
.force("link", d3.forceLink(links).distance(20).strength(1))
.force("x", d3.forceX())
.force("y", d3.forceY())
.stop()
It throws an error on d3.forceLink(links) with Uncaught Error: missing: 4d2b0275-5bc7-e611-81c4-00155df7ea33
.
so why is that error since the link is actually there?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…