Drawing a connecting line between two elements

2020-01-22 13:39发布

How can I (or what tools are available) for drawing a line between two or more elements to connect them? Any combination of HTML/CSS/JavaScript/SVG/Canvas is fine.

If your answer supports any of these, then do mention it:

  • draggable elements
  • draggable/editable connections
  • element overlap avoidance

This question has been updated to consolidate the numerous variations of it.

11条回答
家丑人穷心不美
2楼-- · 2020-01-22 13:55

jsPlumb is an option available that supports drag and drop, as seen by its numerous demos, including the Flowchart demo.

It is available in a free Community edition, and a paid Toolkit edition.

The Toolkit edition wraps the Community edition with a comprehensive data binding layer, as well as several UI widgets for building applications and integrations for popular libraries, and is commercially licensed.

查看更多
戒情不戒烟
3楼-- · 2020-01-22 13:59

JointJS/Rappid supports this use case with its Kitchensink example which supports dragging and dropping of elements, and repositioning of connections. It has many examples.

This answer is based off of Vainbhav Jain's answer.

查看更多
爷的心禁止访问
4楼-- · 2020-01-22 14:02

VisJS supports this with its Arrows example, that supports draggable elements.

It also supports editable connections, with its Interaction Events example.

查看更多
ら.Afraid
5楼-- · 2020-01-22 14:02

GoJS supports this, with its State Chart example, that supports dragging and dropping of elements, and editing of connections.

This answer is based off of Walter Northwoods' answer.

查看更多
手持菜刀,她持情操
6楼-- · 2020-01-22 14:05

mxGraph — used by draw.io — supports this use case, with its Grapheditor example. Documentation. Examples.

This answer is based off of Vainbhav Jain's answer.

查看更多
登录 后发表回答