Flow diagram allows you to create data streams easily and quickly. Install a JavaScript library only and have four lines of code. Draw flow is a JavaScript library to dynamically generates a reasonable flowchart by way of drag and drop.
Features
- Drag Nodes
- Multiple Inputs / Outputs
- Multiple connections
- Delete Nodes and Connections
- Add/Delete inputs/outputs
- Reroute connections
- Data sync on Nodes
- Zoom in / out
- Clear data module
- Support modules
- Editor mode
edit
,fixed
orview
- Import / Export data
- Events
- Mobile support
- Vanilla javascript (No dependencies)
- NPM
- Vue Support component nodes && Nuxt
Must Read: Best Pure Flow Chart In CSS & HTML | CSS Process Diagram
How to make use of it:
Install & Download:
# NPM $ npm install drawflow --save
1. Import the draw flow as the ES module.
import Drawflow from 'drawflow' import styleDrawflow from 'drawflow/dist/drawflow.min.css'
2. Or Load the Drawflow’s JavaScript and CSS records data within the document.
<link rel="stylesheet" href="/path/to/dist/drawflow.min.css"> <script src="/path/to/dist/drawflow.min.js"></script>
3. Create a container in the place you need to flowchart.
<div id="drawflow"></div>
4. Initialize the flowchart builder.
var example = document.getElementById("drawflow"); const editor = new Drawflow(example);
5. Start modifying the flowchart.
editor.start();
6. add nodes to the flowchart.
editor.addNode(name, inputs, outputs, posx, posy, class, data, html);
7. Register reusable nodes.
var html = document.createElement("div"); html.innerHTML = "Hello World!"; editor.registerNode('myNode', html); editor.addNode('newNode', 0, 1, 150, 300, 'newNode', data, 'myNode', true);
8. Export & import chart data.
var exportdata = editor.export(); editor.import(exportdata);
9. Disable the editor mode.
editor.editor_mode = 'fixed';
10. Adjust the min/max zoom components.
editor.zoom_max = 1.6; editor.zoom_min = 0.5;
11. More API strategies.
// remove a node editor.removeNodeId(id); // add a connection editor.addConnection(id_output, id_input, output_class, input_class) // remove connection editor.removeSingleConnection(id_output, id_input, output_class, input_class) // add input to node editor.addNodeInput(id) // add output to node editor.addNodeOutput(id) // remove input from node. editor.removeNodeInput(id, input_class) // remove output from node editor.removeNodeOutput(id, output_class) // remove a collection between nodes editor.removeConnectionNodeId(id); // clear the data of the selected node editor.clearModuleSelected(); // clear all data editor.clear(); // zoom in/out editor.zoom_in(); editor.zoom_out();
12. Event handlers.
editor.on('nodeCreated', function(id) { // do something }) editor.on('nodeRemoved', function(id) { // do something }) editor.on('nodeSelected', function(id) { // do something }) editor.on('connectionCreated', function(ouput_id, input_id, ouput_class, input_class) { // do something }) editor.on('connectionRemoved', function(ouput_id, input_id, ouput_class, input_class) { // do something }) editor.on('moduleCreated', function(name) { // do something }) editor.on('moduleChanged', function(name) { // do something }) editor.on('mouseMove', function(x, y) { // do something }) editor.on('zoom', function(zoom_level) { // do something }) editor.on('translate', function(x, y) { // do something }) editor.on('import', function() { // do something })
Mouse and Keys
del key
to remove the element.Right click
to show remove options (Mobile long press).Left click press
to move the editor or node selected.Ctrl + Mouse Wheel
Zoom in/out (Mobile pinch).
Options
Must Read: jQuery Plugin For Creating An SVG Based Flowchart JS
Parameter | Type | Default | Description |
---|---|---|---|
reroute | Boolean | false | Active reroute |
reroute_fix_curvature | Boolean | false | Fix adding points |
curvature | Number | 0.5 | Curvature |
reroute_curvature_start_end | Number | 0.5 | Curvature reroute first point and last point |
reroute_curvature | Number | 0.5 | Curvature reroute |
reroute_width | Number | 6 | Width of reroute |
line_path | Number | 5 | Width of line |
force_first_input | Boolean | false | Force the first input to drop the connection on top of the node |
editor_mode | Text | edit | edit for edit, fixed for nodes fixed but their input fields available, view for view only |
zoom | Number | 1 | Default zoom |
zoom_max | Number | 1.6 | Default zoom max |
zoom_min | Number | 0.5 | Default zoom min |
zoom_value | Number | 0.1 | Default zoom value update |
zoom_last_value | Number | 1 | Default zoom last value |
draggable_inputs | Boolean | true | Drag nodes on click inputs |
useuuid | Boolean | false | Use UUID as node ID instead of an integer index. Only affect newly created nodes, do not affect imported nodes |
Nodes
Must Read: Javascript Interactive Flowchart & Designer Component for Vue.js
Parameter | Type | Description |
---|---|---|
name | text | Name of module |
inputs | number | Number of de inputs |
outputs | number | Number of de outputs |
pos_x | number | Position on start node left |
pos_y | number | Position on start node top |
class | text | Added classname to de node. Multiple classnames separated by space |
data | json | Data passed to the node |
html | text | HTML drew on a node or name of register node. |
typenode | boolean & text | Default false , true for Object HTML, vue for vue |
Events
You can detect events that are happening.
Must Read: A Vue3 Block Organization Tree View Component Library
List of available events:
Event | Return | Description |
---|---|---|
nodeCreated | id | id of Node |
nodeRemoved | id | id of Node |
nodeDataChanged | id | id of Node df-* attributes changed. |
nodeSelected | id | id of Node |
nodeUnselected | true | Unselect node |
nodeMoved | id | id of Node |
connectionStart | { output_id, output_class } | id of nodes and output selected |
connectionCancel | true | Connection Cancel |
connectionCreated | { output_id, input_id, output_class, input_class } | id ‘s of nodes and output/input selected |
connectionRemoved | { output_id, input_id, output_class, input_class } | id ‘s of nodes and output/input selected |
connectionSelected | { output_id, input_id, output_class, input_class } | id ‘s of nodes and output/input selected |
connectionUnselected | true | Unselect connection |
addReroute | id | id of Node output |
removeReroute | id | id of Node output |
rerouteMoved | id | id of Node output |
moduleCreated | name | name of Module |
moduleChanged | name | name of Module |
moduleRemoved | name | name of Module |
click | event | Click event |
clickEnd | event | Once the click changes have been made |
contextmenu | event | Click the second button mouse event |
mouseMove | { x, y } | Position |
mouseUp | event | MouseUp Event |
keydown | event | Keydown event |
zoom | zoom_level | Level of zoom |
translate | { x, y } | Position translate editor |
import | import | Finish import |
export | data | Data export |
See Demo And Download

Official Website(jerosoler): Click Here
This superior jQuery/javascript plugin is developed by jerosoler. For extra advanced usage, please go to the official website.