UNPKG

1.5 kBHTMLView Raw
1<!doctype html>
2<html>
3<head>
4 <title>Network | Basic usage</title>
5
6 <script type="text/javascript" src="../../../dist/vis-network.min.js"></script>
7 <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" />
8
9 <style type="text/css">
10 #mynetwork {
11 width: 600px;
12 height: 400px;
13 border: 1px solid lightgray;
14 }
15 </style>
16</head>
17<body>
18
19<p>
20 There are a lot of options with arrows! They can also be combined with dashed lines.
21</p>
22
23<div id="mynetwork"></div>
24
25<script type="text/javascript">
26 // create an array with nodes
27 var nodes = new vis.DataSet([
28 {id: 1, label: 'Node 1'},
29 {id: 2, label: 'Node 2'},
30 {id: 3, label: 'Node 3'},
31 {id: 4, label: 'Node 4'},
32 {id: 5, label: 'Node 5'},
33 {id: 6, label: 'Node 6'},
34 {id: 7, label: 'Node 7'},
35 {id: 8, label: 'Node 8'}
36 ]);
37
38 // create an array with edges
39 var edges = new vis.DataSet([
40 {from: 1, to: 8, arrows:'to', dashes:true},
41 {from: 1, to: 3, arrows:'to'},
42 {from: 1, to: 2, arrows:'to, from'},
43 {from: 2, to: 4, arrows:'to, middle'},
44 {from: 2, to: 5, arrows:'to, middle, from'},
45 {from: 5, to: 6, arrows:{to:{scaleFactor:2}}},
46 {from: 6, to: 7, arrows:{middle:{scaleFactor:0.5},from:true}}
47 ]);
48
49 // create a network
50 var container = document.getElementById('mynetwork');
51 var data = {
52 nodes: nodes,
53 edges: edges
54 };
55 var options = {};
56 var network = new vis.Network(container, data, options);
57</script>
58
59
60</body>
61</html>