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.

160 lines
8.2 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/newdocs.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. <script src="../js/smooth-scroll.min.js"></script>
  19. <script language="JavaScript">
  20. smoothScroll.init();
  21. </script>
  22. <style>
  23. td.method {
  24. width:250px;
  25. }
  26. </style>
  27. </head>
  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" aria-expanded="false" aria-controls="navbar">
  37. <span class="sr-only">Toggle navigation</span>
  38. <span class="icon-bar"></span>
  39. <span class="icon-bar"></span>
  40. <span class="icon-bar"></span>
  41. </button>
  42. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  43. </div>
  44. <div id="navbar" class="navbar-collapse collapse">
  45. <ul class="nav navbar-nav">
  46. <li><a href="../index.html#modules">Modules</a></li>
  47. <li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
  48. <li><a href="../blog.html">Blog</a></li>
  49. <li><a href="../index.html#download_install">Download</a></li>
  50. <li><a href="../showcase/index.html">Showcase</a></li>
  51. <li><a href="../index.html#contribute">Contribute</a></li>
  52. <li><a href="../featureRequests.html">Feature requests</a></li>
  53. <li><a href="../index.html#licenses">License</a></li>
  54. </ul>
  55. </div>
  56. </div>
  57. </nav>
  58. </div>
  59. </div>
  60. <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>
  61. <div class="container full">
  62. <h1>Network - view</h1>
  63. <p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p>
  64. <h3>Options</h3>
  65. <p>The view has no options.</p>
  66. <h3>Methods</h3>
  67. <p>This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.</p>
  68. <table class="moduleTable">
  69. <tr class="header"><td class="method">name</td><td>returns</td><td>description</td></tr>
  70. <tr><td>getScale()</td> <td class="mid">Number</td><td>Returns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.</td></tr>
  71. <tr><td>getPosition()</td> <td class="mid">Number</td><td>Returns the current central focus point of the camera.</td></tr>
  72. <tr><td>moveTo(<code>Object options</code>)</td> <td class="mid">none</td><td>You can animate or move the camera using the moveTo method. Options are:
  73. <pre class="code">
  74. {
  75. position: {x:Number, y:Number},
  76. scale: Number,
  77. offset: {x:Number, y:Number}
  78. animation: { // -------------------> can be a boolean too!
  79. duration: Number
  80. easingFunction: String
  81. }
  82. }
  83. </pre>
  84. The position (in canvas units!) is the position of the central focus point of the camera. <br><br>
  85. The scale is the target zoomlevel. Default value is 1.0. <br><br>
  86. The offset (in DOM units) is how many pixels from the center the view is focussed. Default value is {x:0,y:0}.<br><br>
  87. For animation you can either use a Boolean to use it with the default options or disable it or you can define the duration (in milliseconds) and easing function manually. Available are:
  88. <code>linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint</code>. <br><br>
  89. <i>You will have to define at least a scale or a position. Otherwise, there is nothing to move to.</i>
  90. </td></tr>
  91. <tr><td>zoomExtent(<code>[Object options]</code>)</td><td class="mid">none</td><td>Zooms out so all nodes fit on the canvas. You can supply options to customize this:
  92. <pre class="code">
  93. {
  94. nodes:[Array of nodeIds],
  95. duration: Number,
  96. easingFunction: String
  97. }
  98. </pre>
  99. The nodes can be used to zoom to fit only specific nodes in the view. <br /><br />
  100. The other options are explained in the <code>moveTo()</code> description above.
  101. All options are optional for zoomExtent.
  102. </td></tr>
  103. <tr><td>focusOnNode(<br>
  104. &nbsp;&nbsp;&nbsp;<code>String nodeId</code>,<br>
  105. &nbsp;&nbsp;&nbsp;<code>[Object options]</code><br>)</td><td class="mid">none</td>
  106. <td>You can focus on a node with this function. What that means is the view will lock onto that node, if it is moving, the view will also move accordingly. If the view is dragged by the user, the focus is broken.
  107. You can supply options to customize the effect:
  108. <pre class="code">
  109. {
  110. scale: Number,
  111. offset: {x:Number, y:Number}
  112. locked: boolean
  113. animation: { // -------------------> can be a boolean too!
  114. duration: Number
  115. easingFunction: String
  116. }
  117. }
  118. </pre>
  119. All options except for locked are explained in the <code>moveTo()</code> description above. Locked denotes whether or not the view remains locked to the node once the zoom-in animation is finished. Default value is true. The options object is optional in focusOnNode.</td></tr>
  120. <tr><td>releaseNode()</td><td class="mid">none</td><td>Programatically release the focussed node.</td></tr>
  121. </table>
  122. <h3>Events</h3>
  123. <p>These events are fired by the renderer and can be used to move and draw custom elements on the same canvas as the rest of the network.</p>
  124. <table class="moduleTable">
  125. <tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr>
  126. <tr><td>animationFinished</td><td class="mid">none</td><td>Fired when an animation is finished.</td>
  127. </table>
  128. <br />
  129. <br />
  130. <br />
  131. <br />
  132. <br />
  133. <br />
  134. <br />
  135. </div>
  136. <!-- Bootstrap core JavaScript
  137. ================================================== -->
  138. <!-- Placed at the end of the document so the pages load faster -->
  139. <script src="../js/jquery.min.js"></script>
  140. <script src="../js/bootstrap.min.js"></script>
  141. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  142. <script src="../js/ie10-viewport-bug-workaround.js"></script>