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.

103 lines
2.9 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: 800px;
  11. height: 800px;
  12. border: 1px solid lightgray;
  13. background-color:#333333;
  14. }
  15. </style>
  16. <script type="text/javascript" src="../../dist/vis.js"></script>
  17. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  18. <script type="text/javascript">
  19. var DIR = 'img/soft-scraps-icons/';
  20. var nodes = null;
  21. var edges = null;
  22. var network = null;
  23. // Called when the Visualization API is loaded.
  24. function draw() {
  25. // create people.
  26. // value corresponds with the age of the person
  27. var DIR = 'img/indonesia/';
  28. nodes = [
  29. {id: 1, shape: 'circularImage', image: DIR + '1.png'},
  30. {id: 2, shape: 'circularImage', image: DIR + '2.png'},
  31. {id: 3, shape: 'circularImage', image: DIR + '3.png'},
  32. {id: 4, label:"pictures by this guy!", shape: 'circularImage', image: DIR + '4.png'},
  33. {id: 5, shape: 'circularImage', image: DIR + '5.png'},
  34. {id: 6, shape: 'circularImage', image: DIR + '6.png'},
  35. {id: 7, shape: 'circularImage', image: DIR + '7.png'},
  36. {id: 8, shape: 'circularImage', image: DIR + '8.png'},
  37. {id: 9, shape: 'circularImage', image: DIR + '9.png'},
  38. {id: 10, shape: 'circularImage', image: DIR + '10.png'},
  39. {id: 11, shape: 'circularImage', image: DIR + '11.png'},
  40. {id: 12, shape: 'circularImage', image: DIR + '12.png'},
  41. {id: 13, shape: 'circularImage', image: DIR + '13.png'},
  42. {id: 14, shape: 'circularImage', image: DIR + '14.png'}
  43. ];
  44. // create connetions between people
  45. // value corresponds with the amount of contact between two people
  46. edges = [
  47. {from: 1, to: 2},
  48. {from: 2, to: 3},
  49. {from: 2, to: 4},
  50. {from: 4, to: 5},
  51. {from: 4, to: 10},
  52. {from: 4, to: 6},
  53. {from: 6, to: 7},
  54. {from: 7, to: 8},
  55. {from: 8, to: 9},
  56. {from: 8, to: 10},
  57. {from: 10, to: 11},
  58. {from: 11, to: 12},
  59. {from: 12, to: 13},
  60. {from: 13, to: 14},
  61. ];
  62. // create a network
  63. var container = document.getElementById('mynetwork');
  64. var data = {
  65. nodes: nodes,
  66. edges: edges
  67. };
  68. var options = {
  69. nodes: {
  70. shape: 'circle',
  71. borderWidth:4,
  72. color: {
  73. border: '#222222',
  74. background: '#ffffff',
  75. highlight: {
  76. border: '#428eff',
  77. background: '#ffffff'
  78. }
  79. },
  80. fontColor:'#eeeeee'
  81. },
  82. edges: {
  83. color: 'lightgray'
  84. }
  85. };
  86. network = new vis.Network(container, data, options);
  87. }
  88. </script>
  89. </head>
  90. <body onload="draw()">
  91. <div id="mynetwork"></div>
  92. <div id="info"></div>
  93. </body>
  94. </html>