Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unconnected nodes drifting infinitely away #354

Open
RealmX1 opened this issue May 30, 2024 · 1 comment
Open

unconnected nodes drifting infinitely away #354

RealmX1 opened this issue May 30, 2024 · 1 comment

Comments

@RealmX1
Copy link

RealmX1 commented May 30, 2024

When dragging any node, all other nodes unconnected to it drift away without any bounding force pulling back together.

It seems that most if not all of the examples shows such property. (especially obvious when trying the final example where you can create node and edges by yourself.

Is this intentional by design? Is there a way to set a bounding force that prevent unconnected nodes from drifting too far?

@jodyphelan
Copy link

Try setting x and y forces: https://d3js.org/d3-force/center#center_x. For example:

    Graph
      .d3Force('x', d3.forceX(0).strength(0.02))
      .d3Force('y', d3.forceY(0).strength(0.02))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants