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.

168 lines
12 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. <!DOCTYPE html>
  2. <html lang="en"><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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3. <meta charset="utf-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="description" content="">
  7. <meta name="author" content="">
  8. <link rel="icon" HREF="favicon.ico">
  9. <title>vis.js - Layout documentation.</title>
  10. <!-- Bootstrap core CSS -->
  11. <link href="../css/bootstrap.css" rel="stylesheet">
  12. <!-- Tipue vendor css -->
  13. <link href="../css/tipuesearch.css" rel="stylesheet">
  14. <link href="../css/style.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  21. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  22. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  23. <script src="../js/smooth-scroll.min.js"></script>
  24. <script language="JavaScript">
  25. smoothScroll.init();
  26. </script>
  27. <!-- Tipue vendor css -->
  28. <link href="../css/tipuesearch.css" rel="stylesheet">
  29. <script type="text/javascript" src="../js/toggleTable.js"></script>
  30. </head>
  31. <body onload="prettyPrint();">
  32. <!-- NAVBAR
  33. ================================================== -->
  34. <body>
  35. <div class="navbar-wrapper">
  36. <div class="container">
  37. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  38. <div class="container">
  39. <div class="navbar-header">
  40. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  41. aria-expanded="false" aria-controls="navbar">
  42. <span class="sr-only">Toggle navigation</span>
  43. <span class="icon-bar"></span>
  44. <span class="icon-bar"></span>
  45. <span class="icon-bar"></span>
  46. </button>
  47. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  48. </div>
  49. <div id="navbar" class="navbar-collapse collapse">
  50. <ul class="nav navbar-nav">
  51. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  52. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  53. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  54. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  55. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  56. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  57. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  58. </ul>
  59. <form class="navbar-form navbar-right" role="search">
  60. <input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
  61. <button type="button" class="btn btn-default" onclick="vis.initSiteSearch(true);">Go!</button>
  62. </form>
  63. <div id="search-results-wrapper" class="panel panel-default">
  64. <div class="panel-body">
  65. <div id="tipue_search_content"></div>
  66. </div>
  67. </div>
  68. <div id="keyword-info" class="panel panel-success">
  69. <div class="panel-body">
  70. Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </nav>
  76. </div>
  77. </div>
  78. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  79. <div class="container full">
  80. <h1>Network - layout</h1>
  81. <p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p>
  82. <h3>Options</h3>
  83. <p>The options for the layout module have to be contained in an object titled 'layout'.</p>
  84. <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
  85. <ul class="nav nav-tabs">
  86. <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
  87. <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
  88. <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
  89. </ul>
  90. <br>
  91. <pre class="prettyprint lang-js options top hidden" id="fullOptions">
  92. // these are all options in full.
  93. var options = {
  94. layout: {
  95. randomSeed: undefined,
  96. improvedLayout:true,
  97. hierarchical: {
  98. enabled:false,
  99. levelSeparation: 150,
  100. nodeSpacing: 100,
  101. treeSpacing: 200,
  102. blockShifting: true,
  103. edgeMinimization: true,
  104. parentCentralization: true,
  105. direction: 'UD', // UD, DU, LR, RL
  106. sortMethod: 'hubsize' // hubsize, directed
  107. }
  108. }
  109. }
  110. network.setOptions(options);
  111. </pre>
  112. <pre class="prettyprint lang-js options top hidden" id="shortOptions">
  113. // only the options that have shorthand notations are shown.
  114. var options = {
  115. layout:{
  116. hierarchical: true
  117. }
  118. }
  119. network.setOptions(options);
  120. </pre>
  121. <p>When enabling the hierarchical layout, it overrules some of the other options. The physics is set to the hierarchical repulsion solver and dynamic smooth edges are converted to static smooth edges.</p>
  122. <table class="options" id="optionTable">
  123. <tr><th>Name</th><th>Type</th><th>Default</th><td>Description</td></tr>
  124. <tr><td>randomSeed</td><td>Number</td><td><code>undefined</code></td> <td>When NOT using the hierarchical layout, the nodes are randomly positioned initially. This means that the settled result is different every time. If you provide a random seed manually, the layout will be the same every time. Ideally you try with an undefined seed, reload until you are happy with the layout and use the <code>getSeed()</code> method to ascertain the seed.</td></tr>
  125. <tr id="layout"><td>improvedLayout</td><td>Boolean</td><td><code>true</code></td> <td>When enabled, the network will use the Kamada Kawai algorithm for initial layout. For networks larger than 100 nodes, clustering will be performed automatically to reduce the amount of nodes. This can greatly improve the stabilization times. If the network is very interconnected (no or few leaf nodes), this may not work and it will revert back to the old method. Performance will be improved in the future.</td></tr>
  126. <tr class='toggle collapsible' onclick="toggleTable('optionTable','hierarchical', this);"><td><span parent="repulsion" class="right-caret"></span> hierarchical</td><td>Object or Boolean</td><td><code>Object</code></td> <td>When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.</td></tr>
  127. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.enabled</td><td>Boolean</td><td><code>false</code></td> <td>Toggle the usage of the hierarchical layout system. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
  128. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.levelSeparation</td><td>Number</td><td><code>150</code></td> <td>The distance between the different levels.</td></tr>
  129. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.nodeSpacing</td><td>Number</td><td><code>100</code></td> <td>Minimum distance between nodes on the free axis. This is only for the initial layout. If you enable physics, the node distance there will be the effective node distance.</td></tr>
  130. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.treeSpacing</td><td>Number</td><td><code>200</code></td> <td>Distance between different trees (independent networks). This is only for the initial layout. If you enable physics, the repulsion model will denote the distance between the trees.</td></tr>
  131. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.blockShifting</td><td>Boolean</td><td><code>true</code></td> <td>Method for reducing whitespace. Can be used alone or together with edge minimization. Each node will check for whitespace and will shift
  132. it's branch along with it for as far as it can, respecting the nodeSpacing on any level. This is mainly for the initial layout. If you enable physics, they layout will be determined by the physics. This will greatly speed up the stabilization time though!</td></tr>
  133. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.edgeMinimization</td><td>Boolean</td><td><code>true</code></td> <td>Method for reducing whitespace. Can be used alone or together with block shifting. Enabling block shifting will usually speed up the layout process.
  134. Each node will try to move along its free axis to reduce the total length of it's edges. This is mainly for the initial layout. If you enable physics, they layout will be determined by the physics. This will greatly speed up the stabilization time though!</td></tr>
  135. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.parentCentralization</td><td>Boolean</td><td><code>true</code></td> <td>When true, the parents nodes will be centered again after the the layout algorithm has been finished.</td></tr>
  136. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.direction</td><td>String</td><td><code>'UD'</code></td> <td>The direction of the hierarchical layout. The available options are: <code>UD, DU, LR, RL</code>. To simplify: up-down, down-up, left-right, right-left.</td></tr>
  137. <tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.sortMethod</td><td>String</td><td><code>'hubsize'</code></td> <td>The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: <code>hubsize, directed</code>. <br><br>
  138. Hubsize takes the nodes with the most edges and puts them at the top. From that the rest of the hierarchy is evaluated. <br><br>
  139. Directed adheres to the to and from data of the edges. A --> B so B is a level lower than A.</td></tr>
  140. </table>
  141. </div>
  142. <!-- Bootstrap core JavaScript
  143. ================================================== -->
  144. <!-- Placed at the end of the document so the pages load faster -->
  145. <script src="../js/jquery.min.js"></script>
  146. <script src="../js/bootstrap.min.js"></script>
  147. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  148. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  149. <!-- jquery extensions -->
  150. <script src="../js/jquery.highlight.js"></script>
  151. <script src="../js/jquery.url.min.js"></script>
  152. <!-- Tipue vendor js -->
  153. <script src="../js/tipuesearch.config.js"></script>
  154. <script src="../js/tipuesearch.js"></script>
  155. <!-- controller -->
  156. <script src="../js/main.js"></script>