Git Product home page Git Product logo

actdag's Introduction

dag based on jsplumb.

Like https://github.com/jdk137/dag, but user can add link through interactives. User can adjust every node's location and linkage, to get the layout data.

You can diy any style and interactive callback as you wish.

example image

There are 4 online demos:

  • basic basic usage example.

  • multi no conflict with multiComponent in one page.

  • recover backward and forward of previous actions.

  • no loc show how to layout nodes and links automatically.

the component provide these APIs:

drawNode,

addLink, deleteLink, addLinks, getLinks,

addNode, deleteNode, deleteNode, getNodes,

setSource,

getSaveData;

and these callbacks:

nodeAddedCallback,

nodeDeletedCallback,

nodeAddFailCallback,

linkAddedCallback,

linkDeletedCallback,

linkAddFailCallback,

linkRightClickCallback;

the data structure with loc

{"nodes":[
	{"id":"opened","name":"opened","loc":{"left":"120","top":"60"}},
	{"id":"phone1","name":"phone1","loc":{"left":"420","top":"144"}},
	{"id":"phone2","name":"phone2","loc":{"left":"336","top":"288"}},
	{"id":"inperson","name":"inperson","loc":{"left":"144","top":"276"}},
	{"id":"rejected","name":"rejected","loc":{"left":"120","top":"420"}}
],
"links":[
	{"source":"opened","target":"phone1"},
	{"source":"phone1","target":"inperson"},
	{"source":"phone1","target":"phone2"}
]}

the data structure without loc (auto layout)

{"nodes":[
	{"id":"opened","name":"opened","testAttr":"test"},
	{"id":"phone1","name":"phone1"},
	{"id":"phone2","name":"phone2"},
	{"id":"inperson","name":"inperson"},
	{"id":"rejected","name":"rejected"}
],
"links":[
	{"source":"opened","target":"phone1"},
	{"source":"phone1","target":"inperson"},
	{"source":"phone1","target":"phone2"},
	{"source":"phone2","target":"rejected"}
]}

You can expand the json as you wish.

actdag's People

Watchers

 avatar  avatar

Forkers

wwwk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.