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/index.html#licenses">License</a></li>
  57. </ul>
  58. <form class="navbar-form navbar-right" role="search">
  59. <input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
  60. <button type="button" class="btn btn-default" onclick="vis.initSiteSearch(true);">Go!</button>
  61. </form>
  62. <div id="search-results-wrapper" class="panel panel-default">
  63. <div class="panel-body">
  64. <div id="tipue_search_content"></div>
  65. </div>
  66. </div>
  67. <div id="keyword-info" class="panel panel-success">
  68. <div class="panel-body">
  69. Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </nav>
  75. </div>
  76. </div>
  77. <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>
  78. <div class="container full">
  79. <h1>Network - layout</h1>
  80. <p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p>
  81. <h3>Options</h3>
  82. <p>The options for the layout module have to be contained in an object titled 'layout'.</p>
  83. <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
  84. <ul class="nav nav-tabs">
  85. <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
  86. <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
  87. <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
  88. </ul>
  89. <br>
  90. <pre class="prettyprint lang-js options top hidden" id="fullOptions">
  91. // these are all options in full.
  92. var options = {
  93. layout: {
  94. randomSeed: undefined,
  95. improvedLayout:true,
  96. hierarchical: {
  97. enabled:false,
  98. levelSeparation: 150,
  99. nodeSpacing: 100,
  100. treeSpacing: 200,
  101. blockShifting: true,
  102. edgeMinimization: true,
  103. parentCentralization: true,
  104. direction: 'UD', // UD, DU, LR, RL
  105. sortMethod: 'hubsize' // hubsize, directed
  106. }
  107. }
  108. }
  109. network.setOptions(options);
  110. </pre>
  111. <pre class="prettyprint lang-js options top hidden" id="shortOptions">
  112. // only the options that have shorthand notations are shown.
  113. var options = {
  114. layout:{
  115. hierarchical: true
  116. }
  117. }
  118. network.setOptions(options);
  119. </pre>
  120. <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>
  121. <table class="options" id="optionTable">
  122. <tr><th>Name</th><th>Type</th><th>Default</th><td>Description</td></tr>
  123. <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>
  124. <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>
  125. <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>
  126. <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>
  127. <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>
  128. <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>
  129. <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>
  130. <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
  131. 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>
  132. <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.
  133. 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>
  134. <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>
  135. <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>
  136. <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>
  137. 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>
  138. Directed adheres to the to and from data of the edges. A --> B so B is a level lower than A.</td></tr>
  139. </table>
  140. </div>
  141. <!-- Bootstrap core JavaScript
  142. ================================================== -->
  143. <!-- Placed at the end of the document so the pages load faster -->
  144. <script src="../js/jquery.min.js"></script>
  145. <script src="../js/bootstrap.min.js"></script>
  146. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  147. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  148. <!-- jquery extensions -->
  149. <script src="../js/jquery.highlight.js"></script>
  150. <script src="../js/jquery.url.min.js"></script>
  151. <!-- Tipue vendor js -->
  152. <script src="../js/tipuesearch.config.js"></script>
  153. <script src="../js/tipuesearch.js"></script>
  154. <!-- controller -->
  155. <script src="../js/main.js"></script>