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.

134 lines
3.7 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Custom Groups</title>
  5. <style>
  6. body {
  7. color: #d3d3d3;
  8. font: 12pt arial;
  9. background-color: #222222;
  10. }
  11. #mynetwork {
  12. width: 800px;
  13. height: 800px;
  14. border: 1px solid #444444;
  15. background-color: #222222;
  16. }
  17. </style>
  18. <script type="text/javascript" src="../../../../dist/vis.js"></script>
  19. <link href="../../../../dist/vis.css" rel="stylesheet" type="text/css"/>
  20. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
  21. <script src="../../../googleAnalytics.js"></script>
  22. </head>
  23. <body>
  24. <div id="mynetwork"></div>
  25. <script type="text/javascript">
  26. var color = 'gray';
  27. var len = undefined;
  28. var nodes = [
  29. {id: 0, label: "0", group: 'source'},
  30. {id: 1, label: "1", group: 'icons'},
  31. {id: 2, label: "2", group: 'icons'},
  32. {id: 3, label: "3", group: 'icons'},
  33. {id: 4, label: "4", group: 'icons'},
  34. {id: 5, label: "5", group: 'icons'},
  35. {id: 6, label: "6", group: 'icons'},
  36. {id: 7, label: "7", group: 'icons'},
  37. {id: 8, label: "8", group: 'icons'},
  38. {id: 9, label: "9", group: 'icons'},
  39. {id: 10, label: "10", group: 'mints'},
  40. {id: 11, label: "11", group: 'mints'},
  41. {id: 12, label: "12", group: 'mints'},
  42. {id: 13, label: "13", group: 'mints'},
  43. {id: 14, label: "14", group: 'mints'},
  44. {id: 15, group: 'dotsWithLabel'},
  45. {id: 16, group: 'dotsWithLabel'},
  46. {id: 17, group: 'dotsWithLabel'},
  47. {id: 18, group: 'dotsWithLabel'},
  48. {id: 19, group: 'dotsWithLabel'},
  49. {id: 20, label: "diamonds", group: 'diamonds'},
  50. {id: 21, label: "diamonds", group: 'diamonds'},
  51. {id: 22, label: "diamonds", group: 'diamonds'},
  52. {id: 23, label: "diamonds", group: 'diamonds'},
  53. ];
  54. var edges = [
  55. {from: 1, to: 0},
  56. {from: 2, to: 0},
  57. {from: 4, to: 3},
  58. {from: 5, to: 4},
  59. {from: 4, to: 0},
  60. {from: 7, to: 6},
  61. {from: 8, to: 7},
  62. {from: 7, to: 0},
  63. {from: 10, to: 9},
  64. {from: 11, to: 10},
  65. {from: 10, to: 4},
  66. {from: 13, to: 12},
  67. {from: 14, to: 13},
  68. {from: 13, to: 0},
  69. {from: 16, to: 15},
  70. {from: 17, to: 15},
  71. {from: 15, to: 10},
  72. {from: 19, to: 18},
  73. {from: 20, to: 19},
  74. {from: 19, to: 4},
  75. {from: 22, to: 21},
  76. {from: 23, to: 22},
  77. {from: 23, to: 0},
  78. ]
  79. // create a network
  80. var container = document.getElementById('mynetwork');
  81. var data = {
  82. nodes: nodes,
  83. edges: edges
  84. };
  85. var options = {
  86. nodes: {
  87. shape: 'dot',
  88. size: 20,
  89. font: {
  90. size: 15,
  91. color: '#ffffff'
  92. },
  93. borderWidth: 2
  94. },
  95. edges: {
  96. width: 2
  97. },
  98. groups: {
  99. diamonds: {
  100. color: {background:'red',border:'white'},
  101. shape: 'diamond'
  102. },
  103. dotsWithLabel: {
  104. label: "I'm a dot!",
  105. shape: 'dot',
  106. color: 'cyan'
  107. },
  108. mints: {color:'rgb(0,255,140)'},
  109. icons: {
  110. shape: 'icon',
  111. icon: {
  112. face: 'FontAwesome',
  113. code: '\uf0c0',
  114. size: 50,
  115. color: 'orange'
  116. }
  117. },
  118. source: {
  119. color:{border:'white'}
  120. }
  121. }
  122. };
  123. network = new vis.Network(container, data, options);
  124. </script>
  125. </body>
  126. </html>