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.

82 lines
3.7 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Graph | Scalable images</title>
  5. <style type="text/css">
  6. body {
  7. font: 10pt arial;
  8. }
  9. </style>
  10. <script type="text/javascript" src="../../vis.js"></script>
  11. <script type="text/javascript">
  12. var DIR = 'img/soft-scraps-icons/';
  13. var nodes = null;
  14. var edges = null;
  15. var graph = null;
  16. // Called when the Visualization API is loaded.
  17. function draw() {
  18. // create people.
  19. // value corresponds with the age of the person
  20. var DIR = 'img/soft-scraps-icons/';
  21. nodes = [
  22. {id: 1, value: 2, style: 'image', text: 'Algie', title: 'Algie (2 years old)', image: DIR + 'Smiley-Angry-icon.png'},
  23. {id: 2, value: 31, style: 'image', text: 'Alston', title: 'Alston (31 years old)', image: DIR + 'Smiley-Grin-icon.png'},
  24. {id: 3, value: 12, style: 'image', text: 'Barney', title: 'Barney (12 years old)', image: DIR + 'User-Administrator-Blue-icon.png'},
  25. {id: 4, value: 16, style: 'image', text: 'Coley', title: 'Coley (16 years old)', image: DIR + 'User-Administrator-Green-icon.png'},
  26. {id: 5, value: 17, style: 'image', text: 'Grant', title: 'Grant (17 years old)', image: DIR + 'User-Coat-Blue-icon.png'},
  27. {id: 6, value: 15, style: 'image', text: 'Langdon', title: 'Langdon (15 years old)', image: DIR + 'User-Coat-Green-icon.png'},
  28. {id: 7, value: 6, style: 'image', text: 'Lee', title: 'Lee (6 years old)', image: DIR + 'User-Coat-Red-icon.png'},
  29. {id: 8, value: 5, style: 'image', text: 'Merlin', title: 'Merlin (5 years old)', image: DIR + 'User-Executive-Green-icon.png'},
  30. {id: 9, value: 30, style: 'image', text: 'Mick', title: 'Mick (30 years old)', image: DIR + 'User-Preppy-Blue-icon.png'},
  31. {id: 10, value: 18, style: 'image', text: 'Tod', title: 'Tod (18 years old)', image: DIR + 'User-Preppy-Red-icon.png'}
  32. ];
  33. // create connetions between people
  34. // value corresponds with the amount of contact between two people
  35. edges = [
  36. {from: 2, to: 8, value: 3, title: '3 emails per week'},
  37. {from: 2, to: 9, value: 5, title: '5 emails per week'},
  38. {from: 2, to: 10,value: 1, title: '1 emails per week'},
  39. {from: 4, to: 6, value: 8, title: '8 emails per week'},
  40. {from: 5, to: 7, value: 2, title: '2 emails per week'},
  41. {from: 4, to: 5, value: 1, title: '1 emails per week'},
  42. {from: 9, to: 10,value: 2, title: '2 emails per week'},
  43. {from: 2, to: 3, value: 6, title: '6 emails per week'},
  44. {from: 3, to: 9, value: 4, title: '4 emails per week'},
  45. {from: 5, to: 3, value: 1, title: '1 emails per week'},
  46. {from: 2, to: 7, value: 4, title: '4 emails per week'}
  47. ];
  48. // specify options
  49. var options = {
  50. width: '600px',
  51. height: '600px',
  52. nodes: {
  53. widthMin: 20, // min width in pixels
  54. widthMax: 100 // max width in pixels
  55. },
  56. edges: {
  57. color: 'lightgray'
  58. }
  59. };
  60. // Instantiate our graph object.
  61. graph = new vis.Graph(document.getElementById('mygraph'));
  62. // Draw our graph with the created data and options
  63. graph.draw(nodes, edges, options);
  64. }
  65. </script>
  66. </head>
  67. <body onload="draw()">
  68. <div id="mygraph"></div>
  69. <div id="info"></div>
  70. </body>
  71. </html>