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.

87 lines
2.8 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Scalable images</title>
  5. <style type="text/css">
  6. body {
  7. font: 10pt arial;
  8. }
  9. #mynetwork {
  10. width: 600px;
  11. height: 600px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. <script type="text/javascript" src="../../dist/vis.js"></script>
  16. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  17. <script type="text/javascript">
  18. var DIR = 'img/soft-scraps-icons/';
  19. var nodes = null;
  20. var edges = null;
  21. var network = null;
  22. // Called when the Visualization API is loaded.
  23. function draw() {
  24. // create people.
  25. // value corresponds with the age of the person
  26. var DIR = 'img/soft-scraps-icons/';
  27. nodes = [
  28. {id: 3, shape: 'circularImage', label: 'Barney', title: 'Barney (12 years old)', image: DIR + 'User-Administrator-Blue-icon.png'},
  29. {id: 4, shape: 'circularImage', label: 'Coley', title: 'Coley (16 years old)', image: DIR + 'User-Administrator-Green-icon.png'},
  30. {id: 5, shape: 'circularImage', label: 'Grant', title: 'Grant (17 years old)', image: DIR + 'User-Coat-Blue-icon.png'},
  31. {id: 6, shape: 'circularImage', label: 'Langdon', title: 'Langdon (15 years old)', image: DIR + 'User-Coat-Green-icon.png'},
  32. {id: 7, shape: 'circularImage', label: 'Lee', title: 'Lee (6 years old)', image: DIR + 'User-Coat-Red-icon.png'},
  33. {id: 9, shape: 'circularImage', label: 'Mick', title: 'Mick (30 years old)', image: DIR + 'User-Preppy-Blue-icon.png'},
  34. {id: 10, shape: 'circularImage', label: 'Tod', title: 'Tod (18 years old)', image: DIR + 'User-Preppy-Red-icon.png'}
  35. ];
  36. // create connetions between people
  37. // value corresponds with the amount of contact between two people
  38. edges = [
  39. {from: 4, to: 6, title: '8 emails per week'},
  40. {from: 5, to: 7, title: '2 emails per week'},
  41. {from: 4, to: 5, title: '1 emails per week'},
  42. {from: 9, to: 10, title: '2 emails per week'},
  43. {from: 2, to: 3, title: '6 emails per week'},
  44. {from: 3, to: 9, title: '4 emails per week'},
  45. {from: 5, to: 3, title: '1 emails per week'},
  46. {from: 2, to: 7, title: '4 emails per week'}
  47. ];
  48. // create a network
  49. var container = document.getElementById('mynetwork');
  50. var data = {
  51. nodes: nodes,
  52. edges: edges
  53. };
  54. var options = {
  55. nodes: {
  56. shape: 'circle',
  57. color: {
  58. border: 'orange',
  59. background: 'yellow',
  60. highlight: {
  61. border: 'darkorange',
  62. background: 'gold'
  63. }
  64. }
  65. },
  66. edges: {
  67. color: 'lightgray'
  68. }
  69. };
  70. network = new vis.Network(container, data, options);
  71. }
  72. </script>
  73. </head>
  74. <body onload="draw()">
  75. <div id="mynetwork"></div>
  76. <div id="info"></div>
  77. </body>
  78. </html>