fkling / JSNetworkX

Build, process and analyze graphs in JavaScript (port of NetworkX)
https://felix-kling.de/jsnetworkx/
Other
757 stars 185 forks source link

Fix part of nodes programmatically #84

Open MrFus10n opened 5 years ago

MrFus10n commented 5 years ago

Hey,

I need to create 4 nodes at the edges of the screen and see how network grows among them (with auto positioning). Of course I can move them with stickyDrag: true, but this is too time-consuming as I need to make lots of experiments.

Thanks!

MrFus10n commented 5 years ago

Found a hacky way to set node position:

let node = G.node.get(1);
node.__d3datum__.px = 10;
node.__d3datum__.x = 10;
node.__d3datum__.py = 10;
node.__d3datum__.y = 10;
node.__d3datum__.fixed = 1;