1 | <!doctype html>
|
2 | <html>
|
3 | <head>
|
4 | <title>Network | Label stroke</title>
|
5 | <script type="text/javascript" src="../../../dist/vis-network.min.js"></script>
|
6 | <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" />
|
7 |
|
8 | <style type="text/css">
|
9 | #mynetwork {
|
10 | width: 600px;
|
11 | height: 600px;
|
12 | border: 1px solid lightgray;
|
13 | background:#d1d1d1;
|
14 | }
|
15 | p {
|
16 | max-width:600px;
|
17 | }
|
18 | </style>
|
19 |
|
20 | </head>
|
21 |
|
22 | <body>
|
23 | <p>The stroke of labels is fully can have a width and color. Edgelabels by default have a white stroke for clarity.</p>
|
24 |
|
25 | <div id="mynetwork"></div>
|
26 |
|
27 | <script type="text/javascript">
|
28 |
|
29 | var nodes = [
|
30 | {id: 1, label: 'Node 1', font: {strokeWidth: 3, strokeColor: 'white'}},
|
31 | {id: 2, label: 'Node 2'},
|
32 | {id: 3, label: 'Node 3'},
|
33 | {id: 4, label: 'Node 4'},
|
34 | {id: 5, label: 'Node 5'}
|
35 | ];
|
36 |
|
37 |
|
38 | var edges = [
|
39 | {from: 1, to: 2, label: 'edgeLabel', font: {strokeWidth: 2, strokeColor : '#00ff00'}},
|
40 | {from: 1, to: 3, label: 'edgeLabel'},
|
41 | {from: 2, to: 4},
|
42 | {from: 2, to: 5}
|
43 | ];
|
44 |
|
45 |
|
46 | var container = document.getElementById('mynetwork');
|
47 | var data = {
|
48 | nodes: nodes,
|
49 | edges: edges
|
50 | };
|
51 | var options = {
|
52 | nodes : {
|
53 | shape: 'dot',
|
54 | size: 10
|
55 | }
|
56 | };
|
57 | var network = new vis.Network(container, data, options);
|
58 | </script>
|
59 |
|
60 | </body>
|
61 | </html>
|