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.

197 lines
7.9 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <link rel="icon" HREF="favicon.ico">
  10. <title>vis.js - A dynamic, browser based visualization library.</title>
  11. <!-- Bootstrap core CSS -->
  12. <link href="../css/bootstrap.css" rel="stylesheet">
  13. <link href="../css/newdocs.css" rel="stylesheet">
  14. <link href="../css/prettify.css" type="text/css" rel="stylesheet" />
  15. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  16. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  17. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  18. <!--[if lt IE 9]>
  19. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  20. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  21. <![endif]-->
  22. <script src="../js/smooth-scroll.min.js"></script>
  23. <script language="JavaScript">
  24. smoothScroll.init();
  25. </script>
  26. </head>
  27. <!-- NAVBAR
  28. ================================================== -->
  29. <body onload="prettyPrint();">
  30. <div class="navbar-wrapper">
  31. <div class="container">
  32. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  33. <div class="container">
  34. <div class="navbar-header">
  35. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  36. 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"
  48. src="../img/external-link-icons/external-link-icon-white.png"></a>
  49. </li>
  50. <li><a href="../blog.html">Blog</a></li>
  51. <li><a href="../index.html#download_install">Download</a></li>
  52. <li><a href="../showcase/index.html">Showcase</a></li>
  53. <li><a href="../index.html#contribute">Contribute</a></li>
  54. <li><a href="../featureRequests.html">Feature requests</a></li>
  55. <li><a href="../index.html#licenses">License</a></li>
  56. </ul>
  57. </div>
  58. </div>
  59. </nav>
  60. </div>
  61. </div>
  62. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img
  63. style="position: absolute; top: 0; right: 0; border: 0;"
  64. src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
  65. alt="Fork me on GitHub"
  66. data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  67. <div class="container full">
  68. <h1>Network - canvas</h1>
  69. <p>Handles the HTML part of the canvas.</p>
  70. <h3>Options</h3>
  71. <p>The options for the canvas have to be contained in an object titled 'canvas'.</p>
  72. <pre class="prettyprint lang-js options">
  73. var options = {
  74. canvas:{
  75. width:'100%', // other format: '400px'
  76. height:'100%'
  77. }
  78. }
  79. network.setOptions(options);
  80. </pre>
  81. <p>All of the individual options are explained here:</p>
  82. <table class="moduleTable">
  83. <tr class="header">
  84. <td class="name">name</td>
  85. <td class="type">type</td>
  86. <td class="default">default</td>
  87. <td class="description">description</td>
  88. </tr>
  89. <tr>
  90. <td>width</td>
  91. <td class="mid">String</td>
  92. <td class="mid"><code>'100%'</code></td>
  93. <td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  94. </tr>
  95. <tr>
  96. <td>height</td>
  97. <td class="mid">String</td>
  98. <td class="mid"><code>'100%'</code></td>
  99. <td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  100. </tr>
  101. </table>
  102. <h3>Methods</h3>
  103. <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
  104. setOptions method of the network itself and use the module name as an object name.</p>
  105. <table class="moduleTable">
  106. <tr class="header">
  107. <td class="methodName">name</td>
  108. <td>returns</td>
  109. <td>description</td>
  110. </tr>
  111. <tr>
  112. <td>setSize(<br>&nbsp;&nbsp;&nbsp;<code><i>String width</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>String
  113. height</i></code><br>)
  114. </td>
  115. <td class="mid">none</td>
  116. <td>Set the size of the canvas. This is automatically done on a window resize.</td>
  117. </tr>
  118. <tr>
  119. <td>canvasToDOM({<br>&nbsp;&nbsp;&nbsp;<code><i>x: Number</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>y:
  120. Number</i></code><br>})
  121. </td>
  122. <td class="mid">Object</td>
  123. <td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of
  124. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  125. </td>
  126. </tr>
  127. <tr>
  128. <td>DOMtoCanvas({<br>&nbsp;&nbsp;&nbsp;<code><i>x: Number</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>y:
  129. Number</i></code><br>})
  130. </td>
  131. <td class="mid">Object</td>
  132. <td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of
  133. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  134. </td>
  135. </tr>
  136. </table>
  137. <h3>Events</h3>
  138. <p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
  139. <table class="moduleTable">
  140. <tr class="header">
  141. <td class="eventName">name</td>
  142. <td class="eventProperties">properties</td>
  143. <td>description</td>
  144. </tr>
  145. <tr>
  146. <td>resize</td>
  147. <td class="mid">
  148. <pre class="code">
  149. {
  150. width: Number // the new width of the canvas
  151. height: Number // the new height of the canvas
  152. oldWidth: Number // the old width of the canvas
  153. oldHeight: Number // the old height of the canvas
  154. }
  155. </pre>
  156. <ul>
  157. </ul>
  158. </td>
  159. <td>Fired when the size of the canvas has been resized, either by a redraw call when the container div has
  160. changed in size, a setSize() call with new values or a setOptions() with new width and/or height values.
  161. </td>
  162. </tr>
  163. </table>
  164. <br/>
  165. <br/>
  166. <br/>
  167. <br/>
  168. <br/>
  169. <br/>
  170. <br/>
  171. </div>
  172. <!-- Bootstrap core JavaScript
  173. ================================================== -->
  174. <!-- Placed at the end of the document so the pages load faster -->
  175. <script src="../js/jquery.min.js"></script>
  176. <script src="../js/bootstrap.min.js"></script>
  177. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  178. <script src="../js/ie10-viewport-bug-workaround.js"></script>