vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Label stroke</title>
  5. <script type="text/javascript" src="../../../dist/vis.js"></script>
  6. <link href="../../../dist/vis-network.min.css" rel="stylesheet" type="text/css" />
  7. <style type="text/css">
  8. #mynetwork {
  9. width: 600px;
  10. height: 600px;
  11. border: 1px solid lightgray;
  12. background:#d1d1d1;
  13. }
  14. p {
  15. max-width:600px;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <p>The style of the edges can be fully customized.</p>
  21. <div id="mynetwork"></div>
  22. <script type="text/javascript">
  23. // create an array with nodes
  24. var nodes = [
  25. {id: 1, label: 'Node 1', font: '12px arial red'},
  26. {id: 2, label: 'Node 2', font: {size:12, color:'lime', face:'arial'}},
  27. {id: 3, label: 'Node 3', font: '18px verdana blue'},
  28. {id: 4, label: 'Node 4', font: {size:12, color:'red', face:'sans', background:'white'}},
  29. {id: 5, label: 'Node 5', font: {size:15, color:'red', face:'courier', strokeWidth:3, strokeColor:'#ffffff'}}
  30. ];
  31. // create an array with edges
  32. var edges = [
  33. {from: 1, to: 2},
  34. {from: 1, to: 3},
  35. {from: 2, to: 4},
  36. {from: 2, to: 5}
  37. ];
  38. // create a network
  39. var container = document.getElementById('mynetwork');
  40. var data = {
  41. nodes: nodes,
  42. edges: edges
  43. };
  44. var options = {
  45. nodes : {
  46. shape: 'dot',
  47. size: 10
  48. }
  49. };
  50. var network = new vis.Network(container, data, options);
  51. </script>
  52. </body>
  53. </html>