How to center new nodes in force layout in d3

This is not a new question, and I already mentioned solutions that indicated that before restarting the layout, the nodes should have dx dy parameters corresponding to the appropriate values.

I also created a simple block demonstrating this. However, now that I have developed a more complex example here , I am not satisfied with the result.

The reason is that when you click on nodes, new nodes appear off-screen, and the syntax layout is unstable (not very good), however, after all nodes appear at least once, when the nodes behave as desired and appear close toward the center and therefore create minimal layout disruption.

I feel that either this is the best I can expect from d3, or that there is some inconsistency in the data model model of my code.

The code itself is designed to display a smaller subset of the larger graph loaded from JSON. This allows you to navigate a larger chart with one subset at a time. The subsets are centered on the node that was clicked.

0
javascript
Jun 30 '15 at 1:05
source share

No one has answered this question yet.

See similar questions:

43
Calm the start tick of the power layout

or similar:

7728
How to redirect to another web page?
7649
How do JavaScript locks work?
7494
How to remove a specific element from an array in JavaScript?
7432
How to check if a string contains a substring in JavaScript?
7428
How to check if an element is hidden in jQuery?
5722
How to remove a property from a JavaScript object?
5129
How to return a response from an asynchronous call?
4829
How to include javascript file in another javascript file?
3998
How to check email address in JavaScript
1895
Open the url in a new tab (not in a new window) using JavaScript



All Articles