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.

131 lines
8.5 KiB

  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 - A dynamic, browser based visualization library.</title>
  10. <!-- Bootstrap core CSS -->
  11. <link href="../css/bootstrap.css" rel="stylesheet">
  12. <link href="../css/style.css" rel="stylesheet">
  13. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  14. <!--[if lt IE 9]>
  15. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  16. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  17. <![endif]-->
  18. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  19. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  20. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  21. <script src="../js/smooth-scroll.min.js"></script>
  22. <script language="JavaScript">
  23. smoothScroll.init();
  24. </script>
  25. <script type="text/javascript" src="../js/toggleTable.js"></script>
  26. </head>
  27. <body onload="prettyPrint();">
  28. <!-- NAVBAR
  29. ================================================== -->
  30. <body>
  31. <div class="navbar-wrapper">
  32. <div class="container">
  33. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  34. <div class="container">
  35. <div class="navbar-header">
  36. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  37. aria-expanded="false" aria-controls="navbar">
  38. <span class="sr-only">Toggle navigation</span>
  39. <span class="icon-bar"></span>
  40. <span class="icon-bar"></span>
  41. <span class="icon-bar"></span>
  42. </button>
  43. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  44. </div>
  45. <div id="navbar" class="navbar-collapse collapse">
  46. <ul class="nav navbar-nav">
  47. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  48. <li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
  49. src="../img/external-link-icons/external-link-icon-white.png"></a>
  50. </li>
  51. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  52. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  53. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  54. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  55. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  56. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  57. </ul>
  58. </div>
  59. </div>
  60. </nav>
  61. </div>
  62. </div>
  63. <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>
  64. <div class="container full">
  65. <h1>Network - layout</h1>
  66. <p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p>
  67. <h3>Options</h3>
  68. <p>The options for the layout module have to be contained in an object titled 'layout'.</p>
  69. <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
  70. <ul class="nav nav-tabs">
  71. <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
  72. <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
  73. <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
  74. </ul>
  75. <br>
  76. <pre class="prettyprint lang-js options top hidden" id="fullOptions">
  77. // these are all options in full.
  78. var options = {
  79. layout: {
  80. randomSeed: undefined,
  81. hierarchical: {
  82. enabled:false,
  83. levelSeparation: 150,
  84. direction: 'UD', // UD, DU, LR, RL
  85. sortMethod: 'hubsize' // hubsize, directed
  86. }
  87. }
  88. }
  89. network.setOptions(options);
  90. </pre>
  91. <pre class="prettyprint lang-js options top hidden" id="shortOptions">
  92. // only the options that have shorthand notations are shown.
  93. var options = {
  94. layout:{
  95. hierarchical: true
  96. }
  97. }
  98. network.setOptions(options);
  99. </pre>
  100. <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>
  101. <table class="options" id="optionTable">
  102. <tr><th>Name</th><th>Type</th><th>Default</th><td>Description</td></tr>
  103. <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>
  104. <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>
  105. <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>
  106. <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>
  107. <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>
  108. <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>
  109. 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>
  110. Directed adheres to the to and from data of the edges. A --> B so B is a level lower than A.</td></tr>
  111. </table>
  112. </div>
  113. <!-- Bootstrap core JavaScript
  114. ================================================== -->
  115. <!-- Placed at the end of the document so the pages load faster -->
  116. <script src="../js/jquery.min.js"></script>
  117. <script src="../js/bootstrap.min.js"></script>
  118. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  119. <script src="../js/ie10-viewport-bug-workaround.js"></script>