diff options
Diffstat (limited to 'www/lib/vis/examples/network/edgeStyles')
6 files changed, 415 insertions, 0 deletions
diff --git a/www/lib/vis/examples/network/edgeStyles/arrowTypes.html b/www/lib/vis/examples/network/edgeStyles/arrowTypes.html new file mode 100644 index 00000000..25cf63bf --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/arrowTypes.html @@ -0,0 +1,55 @@ +<!doctype html> +<html> +<head> + <title>Network | Basic usage</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> + + <style type="text/css"> + #mynetwork { + width: 600px; + height: 400px; + border: 1px solid lightgray; + } + </style> +</head> +<body> + +<p> + There two type of liner endings. The classical "arrow" (default) and "circle". +</p> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + // create an array with nodes + var nodes = new vis.DataSet([ + {id: 1, label: 'X'}, + {id: 2, label: 'Y'}, + {id: 3, label: 'Z'} + ]); + + // create an array with edges + var edges = new vis.DataSet([ + {from: 1, to: 2, arrows:'to'}, + {from: 2, to: 3, arrows:{ + to: { + type: 'circle' + } + }}, + ]); + + // create a network + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var options = {}; + var network = new vis.Network(container, data, options); +</script> + +<script src="../../googleAnalytics.js"></script> +</body> +</html> diff --git a/www/lib/vis/examples/network/edgeStyles/arrows.html b/www/lib/vis/examples/network/edgeStyles/arrows.html new file mode 100644 index 00000000..b9d43636 --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/arrows.html @@ -0,0 +1,61 @@ +<!doctype html> +<html> +<head> + <title>Network | Basic usage</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" /> + + <style type="text/css"> + #mynetwork { + width: 600px; + height: 400px; + border: 1px solid lightgray; + } + </style> +</head> +<body> + +<p> + There are a lot of options with arrows! They can also be combined with dashed lines. +</p> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + // create an array with nodes + var nodes = new vis.DataSet([ + {id: 1, label: 'Node 1'}, + {id: 2, label: 'Node 2'}, + {id: 3, label: 'Node 3'}, + {id: 4, label: 'Node 4'}, + {id: 5, label: 'Node 5'}, + {id: 6, label: 'Node 6'}, + {id: 7, label: 'Node 7'}, + {id: 8, label: 'Node 8'} + ]); + + // create an array with edges + var edges = new vis.DataSet([ + {from: 1, to: 8, arrows:'to', dashes:true}, + {from: 1, to: 3, arrows:'to'}, + {from: 1, to: 2, arrows:'to, from'}, + {from: 2, to: 4, arrows:'to, middle'}, + {from: 2, to: 5, arrows:'to, middle, from'}, + {from: 5, to: 6, arrows:{to:{scaleFactor:2}}}, + {from: 6, to: 7, arrows:{middle:{scaleFactor:0.5},from:true}} + ]); + + // create a network + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var options = {}; + var network = new vis.Network(container, data, options); +</script> + +<script src="../../googleAnalytics.js"></script> +</body> +</html> diff --git a/www/lib/vis/examples/network/edgeStyles/colors.html b/www/lib/vis/examples/network/edgeStyles/colors.html new file mode 100644 index 00000000..99d98b11 --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/colors.html @@ -0,0 +1,67 @@ +<!doctype html> +<html> +<head> + <title>Network | Basic usage</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" /> + + <style type="text/css"> + #mynetwork { + width: 600px; + height: 400px; + border: 1px solid lightgray; + } + + p { + max-width:800px; + } + </style> +</head> +<body> + +<p> + There are a lot of options with colors. You can manually define a color or inherit the color from the nodes. You can set the opacity + to override any opacity given by a color. <b>IN ORDER TO USE THE OPACITY, BOTH THE NODES AND THE EDGES NEED COLORS IN HEX OR RGB</b>! +</p> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + // create an array with nodes + var nodes = new vis.DataSet([ + {id: 1, label: 1, color:'#97C2FC'}, + {id: 2, label: 2, color:'#FFFF00'}, + {id: 3, label: 3, color:'#FB7E81'}, + {id: 4, label: 4, color:'#7BE141'}, + {id: 5, label: 5, color:'#6E6EFD'}, + {id: 6, label: 6, color:'#C2FABC'}, + {id: 7, label: 7, color:'#FFA807'}, + {id: 8, label: 8, color:'#6E6EFD'} + ]); + + // create an array with edges + var edges = new vis.DataSet([ + {from: 1, to: 8, color:{color:'red'}}, + {from: 1, to: 3, color:'rgb(20,24,200)'}, + {from: 1, to: 2, color:{color:'rgba(30,30,30,0.2)', highlight:'blue'}}, + {from: 2, to: 4, color:{inherit:'to'}}, + {from: 2, to: 5, color:{inherit:'from'}}, + {from: 5, to: 6, color:{inherit:'both'}}, + {from: 6, to: 7, color:{color:'#ff0000', opacity:0.3}}, + {from: 6, to: 8, color:{opacity:0.3}}, + ]); + + // create a network + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var options = {}; + var network = new vis.Network(container, data, options); +</script> + +<script src="../../googleAnalytics.js"></script> +</body> +</html> diff --git a/www/lib/vis/examples/network/edgeStyles/dashes.html b/www/lib/vis/examples/network/edgeStyles/dashes.html new file mode 100644 index 00000000..941fdc5e --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/dashes.html @@ -0,0 +1,57 @@ +<!doctype html> +<html> +<head> + <title>Network | Basic usage</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" /> + + <style type="text/css"> + #mynetwork { + width: 600px; + height: 400px; + border: 1px solid lightgray; + } + </style> +</head> +<body> + +<p> + Playing with dashes. +</p> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + // create an array with nodes + var nodes = new vis.DataSet([ + {id: 1, label: 'Node 1'}, + {id: 2, label: 'Node 2'}, + {id: 3, label: 'Node 3'}, + {id: 4, label: 'Node 4'}, + {id: 5, label: 'Node 5'}, + {id: 6, label: 'Node 6'} + ]); + + // create an array with edges + var edges = new vis.DataSet([ + {from: 1, to: 3, dashes:true}, + {from: 1, to: 2, dashes:[5,5]}, + {from: 2, to: 4, dashes:[5,5,3,3]}, + {from: 2, to: 5, dashes:[2,2,10,10]}, + {from: 2, to: 6, dashes:false}, + ]); + + // create a network + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var options = {}; + var network = new vis.Network(container, data, options); +</script> + +<script src="../../googleAnalytics.js"></script> +</body> +</html> diff --git a/www/lib/vis/examples/network/edgeStyles/smooth.html b/www/lib/vis/examples/network/edgeStyles/smooth.html new file mode 100644 index 00000000..2b222bdb --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/smooth.html @@ -0,0 +1,78 @@ +<!doctype html> +<html> +<head> + <title>Network | Static smooth curves</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" /> + + <style type="text/css"> + #mynetwork { + width: 500px; + height: 500px; + border: 1px solid lightgray; + } + </style> + <script src="../../googleAnalytics.js"></script> +</head> + +<body> + +<h2>Smooth curves</h2> +<div style="width:700px; font-size:14px; text-align: justify;"> + All the smooth curves in the examples so far have been using dynamic smooth curves. This means that each curve has a + support node which takes part in the physics simulation. For large networks or dense clusters, this may not be the ideal + solution. To solve this, static smooth curves have been added. The static smooth curves are based only on the positions of the connected + nodes. There are multiple ways to determine the way this curve is drawn. This example shows the effect of the different + types. <br /> <br /> + Drag the node around to see how the smooth curves are drawn for each setting. For animated system, we + recommend only the continuous mode. In the next example you can see the effect of these methods on a large network. Keep in mind + that the direction (the from and to) of the curve matters. + <br /> <br /> + When you select the dynamic type, you can see the interaction with the fixed node and the edge, any other type will not interact with other nodes. + <br /> <br /> +</div> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + + // create an array with nodes + var nodes = [ + {id: 1, label: 'Fixed node', x:0, y:0, fixed:true}, + {id: 2, label: 'Drag me', x:150, y:130, physics:false}, + {id: 3, label: 'Obstacle', x:80, y:-80, fixed:true, mass:10} + ]; + + // create an array with edges + var edges = [ + {from: 1, to: 2, arrows:'to'} + ]; + + // create a network + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var options = { + physics:true, + configure:function (option, path) { + if (path.indexOf('smooth') !== -1 || option === 'smooth') { + return true; + } + return false; + }, + edges: { + smooth: { + type: 'continuous' + } + } + }; + var network = new vis.Network(container, data, options); + + +</script> + +</body> +</html> diff --git a/www/lib/vis/examples/network/edgeStyles/smoothWorldCup.html b/www/lib/vis/examples/network/edgeStyles/smoothWorldCup.html new file mode 100644 index 00000000..02b95d6b --- /dev/null +++ b/www/lib/vis/examples/network/edgeStyles/smoothWorldCup.html @@ -0,0 +1,97 @@ +<!doctype html> +<!-- saved from url=(0044)http://kenedict.com/networks/worldcup14/vis/ , thanks Andre!--> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF8"> + <title>Network | Static smooth curves - World Cup Network</title> + + <script type="text/javascript" src="../../../dist/vis.js"></script> + <link type="text/css" rel="stylesheet" href="../../../dist/vis-network.min.css"> + + <script src="../datasources/WorldCup2014.js"></script> + + <style type="text/css"> + #mynetwork { + width: 800px; + height: 800px; + border: 1px solid lightgray; + } + #optionsContainer { + height:280px; + } + </style> + <script src="../../googleAnalytics.js"></script> +</head> + +<body> + +<h2>Static smooth curves - World Cup Network</h2> + +<div style="width:700px; font-size:14px;"> + The static smooth curves are based only on the positions of the connected + nodes. + There are multiple ways to determine the way this curve is drawn. + This example shows the effect of the different types on a large network. + <br/> <br/> + Also shown in this example is the inheritColor option of the edges as well as + the roundness factor. Because the physics has been disabled, the dynamic smooth curves do not work here. +</div> + +<div id="optionsContainer"></div> + +<div id="mynetwork"></div> + +<script type="text/javascript"> + var network; + + function redrawAll() { + var container = document.getElementById('mynetwork'); + var options = { + nodes: { + shape: 'dot', + scaling: { + min: 10, + max: 30 + }, + font: { + size: 12, + face: 'Tahoma' + } + }, + edges: { + color:{inherit:true}, + width: 0.15, + smooth: { + type: 'continuous' + } + }, + interaction: { + hideEdgesOnDrag: true, + tooltipDelay: 200 + }, + configure: { + filter: function (option, path) { + if (option === 'inherit') {return true;} + if (option === 'type' && path.indexOf("smooth") !== -1) {return true;} + if (option === 'roundness') {return true;} + if (option === 'hideEdgesOnDrag') {return true;} + if (option === 'hideNodesOnDrag') {return true;} + return false; + }, + container: document.getElementById('optionsContainer'), + showButton: false + }, + physics: false + }; + + var data = {nodes:nodes, edges:edges}; + // Note: data is coming from ./data/WorldCup2014.js + network = new vis.Network(container, data, options); + } + + redrawAll() + +</script> + +</body> +</html> |
