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.

101 lines
3.0 KiB

10 years ago
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Circular 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, shape: 'circularImage', image: DIR + '4.png', label:"pictures by this guy!"},
  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. {id: 15, shape: 'circularImage', image: DIR + 'missing.png', brokenImage: DIR + 'missingBrokenImage.png', label:"when images\nfail\nto load", }
  44. ];
  45. // create connetions between people
  46. // value corresponds with the amount of contact between two people
  47. edges = [
  48. {from: 1, to: 2},
  49. {from: 2, to: 3},
  50. {from: 2, to: 4},
  51. {from: 4, to: 5},
  52. {from: 4, to: 10},
  53. {from: 4, to: 6},
  54. {from: 6, to: 7},
  55. {from: 7, to: 8},
  56. {from: 8, to: 9},
  57. {from: 8, to: 10},
  58. {from: 10, to: 11},
  59. {from: 11, to: 12},
  60. {from: 12, to: 13},
  61. {from: 13, to: 14},
  62. // {from: 14, to: 15}
  63. ];
  64. // create a network
  65. var container = document.getElementById('mynetwork');
  66. var data = {
  67. nodes: nodes,
  68. edges: edges
  69. };
  70. var options = {
  71. nodes: {
  72. borderWidth:4,
  73. size:30,
  74. color: {
  75. border: '#222222',
  76. background: '#666666'
  77. },
  78. font:{color:'#eeeeee'}
  79. },
  80. edges: {
  81. color: 'lightgray'
  82. }
  83. };
  84. network = new vis.Network(container, data, options);
  85. }
  86. </script>
  87. </head>
  88. <body onload="draw()">
  89. <div id="mynetwork"></div>
  90. <div id="info"></div>
  91. </body>
  92. </html>