@EvilProfesseur wrote:
I'm trying to make subtrees of a force directed layout more discernible, preferably through distancing them from the parent cluster. I figured the best way would be to manipulate the length of the edge leading to an expanded subtree, but the documentation isn't exactly clear on the matter of networks. The force directed layout, when initialized does not create a network. If I set up a network like this:
var network = new go.ForceDirectedNetwork(); network.addParts(diagram.nodes); for (var i=0; i < diagram.model.nodeDataArray.length; i++) { var vertex = new go.ForceDirectedVertex(); var node = diagram.findNodeForData(diagram.model.nodeDataArray[i]); vertex.node = node; network.addVertex(vertex); } for (var i=0; i < diagram.model.linkDataArray.length; i++) { var edge = new go.ForceDirectedEdge(); var link = diagram.findLinkForData(diagram.model.linkDataArray[i]); edge.link = link; network.addEdge(edge); } diagram.layout.network = network;
I get a proper network with all the vertexes and edges, but manipulating them changes nothing, even after invalidating the layout. The only direct example in the documentation (doLayout in Layout class) suggests that a network has to be constructed from scratch every time you'd want to make a change. Is that the intended process? Also, that example suggests that passing the diagram should set the network up properly, but I always get an empty network when doing it this way.
Posts: 2
Participants: 2