Open michaelbdavid opened 4 years ago
Hey there @michaelbdavid take a look at the live sandbox implementation we pause the simulation when the user clicks on the button ⏸️. You can find other examples in the same file to (for resetNodesPositions
and restartSimulation
).
Hi @danielcaldas, Thank you for this pointer very helpful I was able to access those methods that said I now understand the purpose of those calls and they do not accomplish what I was hoping to do. So when a node is added to the graph similar to your default example: https://danielcaldas.github.io/react-d3-graph/sandbox/ it appears nodes are always added to the top left area of the graph. Is there a way to make the graph layout more like https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=marvel when a node is added where nodes that have children always cluster around one another?
Thanks again for help and details, Michael
Great! @michaelbdavid please note that the nodes in the marvel layout example are naturally distributed around a node since many of them (the leaves) only have one connection. It all depends on your graph connections/links. If they are sparse and focused around a few nodes, clusters will naturally emerge. If there are links in between clusters, things tend to not be as clear as the marvel example, by bringing together clusters that do not have that many connections between their participants.
Hi @danielcaldas, Thanks for the response. It's still unclear to me how the nodes layout. When you create a new node for me it always shows up in the top left. Is there a way to have the new node cause a relayout that would place the new node closer to its parent in a cluster?
You assign (x, y)
coordinates to the new node you wish to add. Here's how.
@danielcaldas awesome thx!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hey Guys,
Mostly just a question about using pauseSimulation, resetNodesPositions, restartSimulation. I'm pretty new to d3 so I'm not sure I understand how I can call these on my graph. Is there an example you or others could point me to how how to call these on my graph? Basically I'm looking for away to reload graph after nodes and links have been added dynamically so it gets the nice clustered node look similar to what you have for your Marvel sandbox example. I was hoping the resetNodePositions would do this but its unclear to me how I can access this call.
Thanks, Michael