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
How to completely reset a graph? #310
Comments
Hi @it-pro-berlin-de, thanks for reaching out. Those "stale" coordinates of the nodes are stored in myData.nodes.forEach(node => {
delete node.x;
delete node.y;
}) |
Hi, and thanks for the prompt reply, much appreciated. I don't think I managed to articulate my problem clear enough, though, sorry for that. I do need nodes at those coordinates, and I would have thought that the deletion of stale inventory is taken care of by
I tried putting the loop you suggested above into my reset functions - to no avail. so maybe it's a bug in the library after all. For my purposes it will be sufficient, or maybe even more suitable, to recolour the (deleted) nodes and only remove the links touching them. This seems to work in all situations. |
Hi, I am not by any standards a JavaScript pro so please bear with me if this is a n00b question.
I created a graph where I'd like to offer the possibility to
I have borrowed the node removal code from the "Dynamic Data" example, the click on node code from the "Multiselect" example (dumbed it down a bit because I only need single select) and added the removal of yellow links code myself. All this stuff works.
What does NOT work is resetting the whole graph to the initial data. All links and nodes that had not been deleted will get recreated, but the previously deleted nodes will not. Instead, there will be fixed points where the links leading to the missing nodes converge, but not the nodes themselves.
I've put it into a CodePen: https://codepen.io/cj_berlin/pen/JjaOBgx
I am sure I'm not seeing the forest for the trees so, if you could nudge me in the right direction, that would be awesome.
Thanks in advance!
Evgenij
The text was updated successfully, but these errors were encountered: