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.

123 lines
5.3 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. <script type="text/javascript" src="../dist/vis.js"></script> <!-- network handling framework -->
  7. <link href="../dist/vis.css" rel="stylesheet" type="text/css"/>
  8. <style type="text/css">
  9. #network{
  10. width: 1900px;
  11. height: 800px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <h1>Network Test</h1>
  18. <div id="network"></div>
  19. <script type="text/javascript">
  20. // create an array with nodes
  21. var nodes = [
  22. {"id":3,"label":"SDPBCC\n SDPA","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPBCC"},
  23. {"id":14,"label":"SDPTPH\nSDPTPH","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPTPH"},
  24. {"id":6,"label":"SDPBCC\nSDPBCC","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPBCC"},
  25. {"id":9,"label":"CCNTPH\nCCNTPH","group":"CCN","level":5,"shape":"image","image":"ccn.png","cluster":"CCNTPH"},
  26. {"id":7,"label":"SDPTPH\n SDPA","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPTPH"},
  27. {"id":12,"label":"AIRTPH\n ","group":"AIR","level":3,"shape":"image","image":"air.png","cluster":"AIRTPH"},
  28. {"id":5,"label":"SDPBCC2\n SDPA","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPBCC2"},
  29. {"id":10,"label":"VS:172.26.104.11\n","group":"VS","level":2,"shape":"image","image":"vs.png","cluster":"VS:172.26.104.11"},
  30. {"id":15,"label":"VS:172.26.104.10\n","group":"VS","level":2,"shape":"image","image":"vs.png","cluster":"VS:172.26.104.10"},
  31. {"id":1,"label":"AIRBCC\n ","group":"AIR","level":3,"shape":"image","image":"air.png","cluster":"AIRBCC"},
  32. {"id":4,"label":"CCNBCC\nCCNBCC","group":"CCN","level":5,"shape":"image","image":"ccn.png","cluster":"CCNBCC"},
  33. {"id":16,"label":"SDPTPH2\n SDPA","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPTPH2"},
  34. {"id":2,"label":"VS:172.26.11.16\n","group":"VS","level":2,"shape":"image","image":"vs.png","cluster":"VS:172.26.11.16"},
  35. {"id":8,"label":"VS:172.26.11.15\n","group":"VS","level":2,"shape":"image","image":"vs.png","cluster":"VS:172.26.11.15"},
  36. {"id":13,"label":"SDPTPH2\nSDPTPH2","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPTPH2"},
  37. {"id":11,"label":"SDPBCC2\nSDPBCC2","group":"SDP","level":4,"shape":"image","image":"sdp.png","cluster":"SDPBCC2"}
  38. ];
  39. for (var i = 0; i < nodes.length; i++) {
  40. nodes[i].label = nodes[i].id
  41. nodes[i].shape = "dot"
  42. }
  43. // create an array with edges
  44. var edges = new vis.DataSet([
  45. {"from":12,"to":6,"label":"RPC","font":{"align":"top"}},
  46. {"from":12,"to":15,"label":"XmlRPC","font":{"align":"top"}},
  47. {"from":1,"to":2,"label":"XmlRPC","font":{"align":"top"}},
  48. {"from":12,"to":8,"label":"XmlRPC","font":{"align":"top"}},
  49. {"from":1,"to":10,"label":"XmlRPC","font":{"align":"top"}},
  50. {"from":7,"to":4,"label":"Diameter","font":{"align":"top"}},
  51. {"from":12,"to":10,"label":"XmlRPC","font":{"align":"top"}},
  52. {"from":5,"to":4,"label":"Diameter","font":{"align":"top"}},
  53. {"from":1,"to":8,"label":"XmlRPC","font":{"align":"top"}},
  54. {"from":1,"to":14,"label":"RPC","font":{"align":"top"}},
  55. {"from":1,"to":13,"label":"RPC","font":{"align":"top"}},
  56. {"from":5,"to":9,"label":"Diameter","font":{"align":"top"}},
  57. {"from":3,"to":4,"label":"Diameter","font":{"align":"top"}},
  58. {"from":12,"to":2,"label":"XmlRPC","font":{"align":"top"}},
  59. {"from":3,"to":9,"label":"Diameter","font":{"align":"top"}},
  60. {"from":16,"to":4,"label":"Diameter","font":{"align":"top"}},
  61. {"from":7,"to":9,"label":"Diameter","font":{"align":"top"}},
  62. {"from":16,"to":9,"label":"Diameter","font":{"align":"top"}},
  63. {"from":1,"to":6,"label":"RPC","font":{"align":"top"}},
  64. {"from":12,"to":14,"label":"RPC","font":{"align":"top"}},
  65. {"from":1,"to":15,"label":"XmlRPC","font":{"align":"top"}},
  66. {"from":12,"to":11,"label":"RPC","font":{"align":"top"}},
  67. {"from":12,"to":13,"label":"RPC","font":{"align":"top"}},
  68. {"from":1,"to":11,"label":"RPC","font":{"align":"top"}}
  69. ]);
  70. var showAll=true;
  71. // create a network
  72. var container = document.getElementById('network');
  73. var data = {
  74. nodes: nodes,
  75. edges: edges
  76. };
  77. var options = {
  78. /* edges:{hidden:true}, */
  79. layout: {
  80. randomSeed: undefined,
  81. hierarchical: {
  82. enabled:true,
  83. /* improvedLayout:true,*/
  84. levelSeparation: 250,
  85. nodeSpacing: 150,
  86. blockShifting: true,
  87. direction: 'UD', // UD, DU, LR, RL
  88. sortMethod: 'directed' // hubsize, directed
  89. }
  90. },
  91. physics:{
  92. enabled: false
  93. },
  94. interaction:{
  95. dragNodes:true,
  96. dragView: true,
  97. hideEdgesOnDrag: true,
  98. hideNodesOnDrag: false,
  99. selectConnectedEdges: true,
  100. selectable: true,
  101. multiselect:true,
  102. navigationButtons: true
  103. }
  104. };
  105. var network = new vis.Network(container, data, options);
  106. </script>
  107. </body>
  108. </html>
  109. </script>
  110. </body>
  111. </html>