You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
remove a particular sort of links (marked by colour, in this case yellow) by clicking on a hyperlink outside of the graph
select a node and show info about that node in a separate div
remove one or more nodes (and the links leading to them) by CTRL+clicking on them
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.
Those "stale" coordinates of the nodes are stored in x and y attributes in each of the nodes objects. So, if you want to reset their positions, all you need to do is remove them so they get re-generated from scratch. Something like:
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: