UNPKG

1.62 kBHTMLView Raw
1<!doctype html>
2<html>
3<head>
4 <title>Network | Multiline text</title>
5
6 <style type="text/css">
7 #mynetwork {
8 width: 600px;
9 height: 600px;
10 border: 1px solid lightgray;
11 }
12 </style>
13
14 <script type="text/javascript" src="../../../dist/vis-network.min.js"></script>
15 <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" />
16
17 <script type="text/javascript">
18 function draw() {
19 // create some nodes
20 var nodes = [
21 {id: 1, label: 'Node in\nthe center', shape: 'text', font:{strokeWidth:4}},
22 {id: 2, label: 'Node\nwith\nmultiple\nlines', shape: 'circle'},
23 {id: 3, label: 'This is a lot of text\nbut luckily we can spread\nover multiple lines', shape: 'database'},
24 {id: 4, label: 'This is text\non multiple lines', shape: 'box'},
25 {id: 5, label: 'Little text', shape: 'ellipse'}
26 ];
27
28 // create some edges
29 var edges = [
30 {from: 1, to: 2, color: 'red', width: 3, length: 200}, // individual length definition is possible
31 {from: 1, to: 3, dashes:true, width: 1, length: 200},
32 {from: 1, to: 4, width: 1, length: 200, label:'I\'m an edge!'},
33 {from: 1, to: 5, arrows:'to', width: 3, length: 200, label:'arrows\nare cool'}
34 ];
35
36 // create a network
37 var container = document.getElementById('mynetwork');
38 var data = {
39 nodes: nodes,
40 edges: edges
41 };
42 var options = {};
43 var network = new vis.Network(container, data, options);
44 }
45 </script>
46
47</head>
48
49<body onload="draw()">
50<div id="mynetwork"></div>
51</body>
52</html>