Drawing diagrams using Joint.js

Source: Internet
Author: User

try a few in the JS Draw graph library, or joint.js suitable for some, for the simple diagram display is very suitable. Specific Links:

Http://www.daviddurman.com/automatic-graph-layout-with-jointjs-and-dagre.html


Demo


1.script and CSS Downloads:



Http://jointjs.com/download:


<link rel= "stylesheet" href= "Joint.css" >
<script src= "Joint.js" ></script>
<script src= "Joint.layout.DirectedGraph.js" ></script>


Http://www.daviddurman.com/assets/autolayout.js:


<script src= "Autolayout.js" ></script>


2. Sample code:


<link rel= "stylesheet" href= "Joint.css" ><script src= "joint.js" ></script><script src= " Joint.layout.DirectedGraph.js "></script><script src=" Autolayout.js "></script><textarea Id= "Adjacency-list" rows=40 cols=100>{' a ': [' B '], ' a ': [' C '], ' B ': [' f '], ' C ': [' e ', ' d '], ' d ': [], ' e ': [], ' F ' ': [' g '], ' g ': []}</textarea><br><button id= "Btn-layout" >layout</button><div id= "paper" ></div><script>//main.//-----var graph = new Joint.dia.graph;var paper = new Joint.dia.Paper ({el: $ (' #paper '), width:2000, height:2000, Gridsize:1, model:graph});//Just give the viewport a little padding. V (Paper.viewport) translate, $ (' #btn-layout '). On (' click ', layout), function layout () {try {var Adjac    Encylist = eval (' adjacencylist = ' + $ (' #adjacency-list '). Val ());        } catch (e) {alert (e);}    var cells = buildgraphfromadjacencylist (adjacencylist); Graph.resetcells (cElls); Joint.layout.DirectedGraph.layout (graph, {setlinkvertices:false});} Layout ();</script>


Drawing diagrams using Joint.js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.