Customizable Draggable Flowchart Based on jsPlumb

Add-ons
2026-07-21 12:36 9 次浏览 • 0 次下载 52.4KB
Customizable Draggable Flowchart Based on jsPlumb

Last Updated: 2020-10-28 00:26:05

Usage

1. Files to include:

1
2
3
4
5
6
<link rel="stylesheet" type="text/css" href="./css/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="./css/style.css">
<script type="text/javascript" src="./js/jquery.jsPlumb.min.js"></script>
<script type="text/javascript" src="./js/index.js"></script>

2. Official jsPlumb.js method reference:

jsPlumb Chinese Basic Tutorial

What Can jsPlumb Do?

Whether you should use it depends on what you want to accomplish with jsPlumb. This framework is suitable for web applications that require drawing diagrams, such as Visio-like applications or workflow designers. Since all parameters of diagram elements and connections can be finely controlled, you can draw virtually any type of diagram you can imagine!

Basic Concepts

  • Source Node

  • Target Node

  • Anchor: An anchor is located on either the source node or the target node.

  • Endpoint: An endpoint is located on a connection line.

  • Connector: A connection, also known as a connecting line.

  • Overlays: Elements such as text or arrows displayed on connection lines.

ttt2.png


Anchors [todo]

Anchor Types:

  • Static Anchor

  • Dynamic Anchor

  • Perimeter Anchor

  • Fixed Anchor

Connectors [todo]

Connection Line Types:

  • Bezier: Bezier Curve

  • Straight: Straight Line

  • Flowchart: 90-Degree Connector

  • State Machine

Endpoints [todo]

Endpoint Types:

  • Dot

  • Rectangle

  • Image

  • Blank

Overlays [todo]

Overlays can be understood as elements such as text or arrows displayed on connection lines.

Overlay Types

  • Arrow

  • Label

  • PlainArrow

  • Diamond

  • Custom

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Multiple overlays can be added to a connection line,
// Each overlay can specify a relative position
// HTML can be written directly inside a label-type overlay
//
jsPlumb.connect({
...
connectorOverlays: [
['Arrow', {
width: 10,
length: 10,
location: 1
}],
['Label', {
label: '<button class="delete-node-btn">X</button>',
cssClass: '',
labelStyle: {
color: 'red'
},
events: {
click: function (labelOverlay, originalEvent) {
console.log('click on label overlay for :' + labelOverlay.component)
console.log(labelOverlay)
console.log(originalEvent)
}
}
}]
]
});

Basic Demos

Connect Two Nodes

The jsPlumb.ready method works similarly to jQuery's ready method. jsPlumb.connect is used to create connections.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<div id="diagramContainer">
<div id="item_left" class="item"></div>
<div id="item_right" class="item" style="margin-left:50px;"></div>
</div>
<script>
/* global jsPlumb */
jsPlumb.ready(function () {
jsPlumb.connect({
source: 'item_left',
target: 'item_right',
endpoint: 'Dot'
})
})
</script>

Parameter Description: jsPlumb.connect(config) returns connection

ParametersParameter TypeRequiredDescription
sourceString,Object,EndpointYesThe identifier of the source of the connection. Can be an ID, element, or Endpoint.
targetString,Object,EndpointYesThe identifier of the target of the connection. Can be an ID, element, or Endpoint.
endpointStringOptionalEndpoint type and shape


星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare