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.

100 lines
3.3 KiB

10 years ago
10 years ago
10 years ago
  1. <!doctype html>
  2. <html>
  3. <head><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script>
  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, 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. {id: 15, label:"when images\nfail\nto load", shape: 'circularImage', image: DIR + 'missing.png', brokenImage: DIR + 'missingBrokenImage.png'}
  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. color: {
  74. border: '#222222',
  75. background: '#666666'
  76. },
  77. fontColor:'#eeeeee'
  78. },
  79. edges: {
  80. color: 'lightgray'
  81. }
  82. };
  83. network = new vis.Network(container, data, options);
  84. }
  85. </script>
  86. </head>
  87. <body onload="draw()">
  88. <div id="mynetwork"></div>
  89. <div id="info"></div>
  90. </body>
  91. </html>