Create Data Flows with Drag And Drop Flowchart Builder | Drawflow

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 editfixed or view
  • 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

ParameterTypeDefaultDescription
rerouteBooleanfalseActive reroute
reroute_fix_curvatureBooleanfalseFix adding points
curvatureNumber0.5Curvature
reroute_curvature_start_endNumber0.5Curvature reroute first point and last point
reroute_curvatureNumber0.5Curvature reroute
reroute_widthNumber6Width of reroute
line_pathNumber5Width of line
force_first_inputBooleanfalseForce the first input to drop the connection on top of the node
editor_modeTexteditedit for edit, fixed for nodes fixed but their input fields available, view for view only
zoomNumber1Default zoom
zoom_maxNumber1.6Default zoom max
zoom_minNumber0.5Default zoom min
zoom_valueNumber0.1Default zoom value update
zoom_last_valueNumber1Default zoom last value
draggable_inputsBooleantrueDrag nodes on click inputs
useuuidBooleanfalseUse 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

ParameterTypeDescription
nametextName of module
inputsnumberNumber of de inputs
outputsnumberNumber of de outputs
pos_xnumberPosition on start node left
pos_ynumberPosition on start node top
classtextAdded classname to de node. Multiple classnames separated by space
datajsonData passed to the node
htmltextHTML drew on a node or name of register node.
typenodeboolean & textDefault falsetrue 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:

EventReturnDescription
nodeCreatedidid of Node
nodeRemovedidid of Node
nodeDataChangedidid of Node df-* attributes changed.
nodeSelectedidid of Node
nodeUnselectedtrueUnselect node
nodeMovedidid of Node
connectionStart{ output_id, output_class }id of nodes and output selected
connectionCanceltrueConnection 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
connectionUnselectedtrueUnselect connection
addRerouteidid of Node output
removeRerouteidid of Node output
rerouteMovedidid of Node output
moduleCreatednamename of Module
moduleChangednamename of Module
moduleRemovednamename of Module
clickeventClick event
clickEndeventOnce the click changes have been made
contextmenueventClick the second button mouse event
mouseMove{ x, y }Position
mouseUpeventMouseUp Event
keydowneventKeydown event
zoomzoom_levelLevel of zoom
translate{ x, y }Position translate editor
importimportFinish import
exportdataData export

See Demo And Download

Create-Data-Flows-with-Drag-And-Drop-Flowchart

Official Website(jerosoler): Click Here

This superior jQuery/javascript plugin is developed by jerosoler. For extra advanced usage, please go to the official website.

Related Posts

Cookie-Consent-Using-Bootstrap

How to Create a Simple Cookie Banner Consent Using Bootstrap 4

Cookie Consent Popup Javascript – Quick and simple tutorial for creating a simple Bootstrap cookie banner. If you have a website or blog with people visiting or…

Create-HTML-Terminals

Create Custom HTML Terminals With Pure JavaScript | shell.js

Custom HTML Terminals is A JavaScript library to create HTML terminals on web pages. The shell js JavaScript library offers a straightforward method to create Ubuntu, OS X,…

Bootstrap-Alert-Bootbox

Bootstrap Alert, Confirm, and Flexible Dialog Boxes | Bootbox

Bootbox.js is a small JavaScript library that allows you to create programming dialogs using Bootstrap templates, without having to worry about creating, managing, or removing any required…

Slider-fg-carousel

An Accessible Touch-enabled Slider Web Component | fg-carousel

fg-carousel Slider – A simple & modern slider web component to create versatile, accessible, touch-enabled picture carousels utilizing CSS scroll snap, Custom Element, and Intersection Observer API….

Tags-Input-Component

A Lightweight and Efficient Tags Input Component in Vanilla JS | tagify

tagify transforms an input field or textarea into a tags component, in an easy and customizable way, with great performance and a small code footprint, full of…

copy-to-clipboard-javascript

A Lightweight Library to Copy Text to Clipboard | CopyJS

CopyJS is a lightweight JavaScript library that allows you to copy plain text or HTML content to the clipboard. Must Read: Tiny Library for Copy Text In…

Leave a Reply

Your email address will not be published. Required fields are marked *