• Open in:

Force-Directed Adding Links

Not only can you use amCharts 5 to create amazing force-directed network visuals but you can also use the library as a UI to let users set those links in an engaging visual manner. Try clicking on a node and then click other nodes to link with it.

Key implementation details

We add an event handler for the click event on our nodes. In the handler we select or deselect a node and visually mark it by enabling an outer circle on the selected node. If a node is already selected and some different node is clicked we link or unlink the nodes by calling linkDataItems() or unlinkDataItems() methods of the ForceDirected series.

Related tutorials

Demo source