Is there a way to build an interactive node graph in JavaScript?
Asked Answered
C

2

7

I'm looking to build an interactive node graph on a webpage where you can add nodes with various inputs and outputs and connect them together.

This is an example of what I'm looking to do:

enter image description here

I started to play around with vis.js but I'm not sure it will be able to do the above.

Any suggestions would be appreciated!

Condensate answered 12/8, 2018 at 0:30 Comment(1)
Have a look at d3.js as an alternative - refer to the 'Examples' link as well as here for examples.Trellis
S
3

Generally, such broad questions in form of "is it possible to ...?" are frowned upon at StackOverflow, but the direct answer would be "yes, it is possible" and moreover, vis.js has an example of a manipulatable graph so I recommend you to read the manupulation methods docs and the manipulation module docs which describe methods like addNode, editNode, deleteNode etc.

However, you should note that all the interfaces are usually implemented outside the graph-containing canvas, in html (+js) because it's not trivial to put them inside canvas and, say, show attached to all nodes.

Sarto answered 12/8, 2018 at 19:4 Comment(0)
J
10

For those who (like me) trying to find js libraries for creating interactive graphs here is the list:

Click on images for better quality.

react-flow | demo

react-flow preview

vis-network | demo

vis-network preview

DAG-ToDo | demo

DAG-ToDo preview

flowy | demo

flowy preview

jsplumb | demo

jsplumb preview

react-diagrams | demo

react-diagrams preview

butterfly | demo

butterfly preview

Drawflow | demo

Drawflow preview

Jard answered 21/4, 2022 at 19:12 Comment(0)
S
3

Generally, such broad questions in form of "is it possible to ...?" are frowned upon at StackOverflow, but the direct answer would be "yes, it is possible" and moreover, vis.js has an example of a manipulatable graph so I recommend you to read the manupulation methods docs and the manipulation module docs which describe methods like addNode, editNode, deleteNode etc.

However, you should note that all the interfaces are usually implemented outside the graph-containing canvas, in html (+js) because it's not trivial to put them inside canvas and, say, show attached to all nodes.

Sarto answered 12/8, 2018 at 19:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.