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.

210 lines
8.5 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/toggleTable.js"></script>
  16. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  17. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  18. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  19. <!--[if lt IE 9]>
  20. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  21. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  22. <![endif]-->
  23. <script src="../js/smooth-scroll.min.js"></script>
  24. <script language="JavaScript">
  25. smoothScroll.init();
  26. </script>
  27. </head>
  28. <!-- NAVBAR
  29. ================================================== -->
  30. <body onload="prettyPrint();">
  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="../index.html#modules">Modules</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
  61. style="position: absolute; top: 0; right: 0; border: 0;"
  62. src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
  63. alt="Fork me on GitHub"
  64. data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  65. <div class="container full">
  66. <h1>Network - canvas</h1>
  67. <p>Handles the HTML part of the canvas.</p>
  68. <h3>Options</h3>
  69. <p>The options for the canvas have to be contained in an object titled 'canvas'.</p>
  70. <p>Click on the options shown to show how these options are supposed to be used.</p>
  71. <ul class="nav nav-tabs">
  72. <li role="presentation" class="active" onclick="hideOptions('fullTab','fullOptions');" id="hiddenTab"><a href="#">options hidden</a></li>
  73. <li role="presentation" onclick="toggleTab('fullTab','fullOptions');" id="fullTab"><a href="#">options shown</a></li>
  74. </ul>
  75. <br>
  76. <pre class="prettyprint lang-js options hidden" id="fullOptions">
  77. var options = {
  78. canvas:{
  79. width:'100%', // other format: '400px'
  80. height:'100%',
  81. autoResize: true
  82. }
  83. }
  84. network.setOptions(options);
  85. </pre>
  86. <p>All of the individual options are explained here:</p>
  87. <table>
  88. <tr class="header">
  89. <td class="name">name</td>
  90. <td class="type">type</td>
  91. <td class="default">default</td>
  92. <td class="description">description</td>
  93. </tr>
  94. <tr>
  95. <td>width</td>
  96. <td class="mid">String</td>
  97. <td class="mid"><code>'100%'</code></td>
  98. <td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  99. </tr>
  100. <tr>
  101. <td>height</td>
  102. <td class="mid">String</td>
  103. <td class="mid"><code>'100%'</code></td>
  104. <td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  105. </tr>
  106. <tr>
  107. <td>autoResize</td>
  108. <td class="mid">Boolean</td>
  109. <td class="mid"><code>true</code></td>
  110. <td>If true, the Network will automatically detect when its container is resized, and redraw itself
  111. accordingly. If false, the Network can be forced to repaint after its container has been resized
  112. using the function redraw() and setSize().</td>
  113. </tr>
  114. </table>
  115. <h3>Methods</h3>
  116. <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
  117. setOptions method of the network itself and use the module name as an object name.</p>
  118. <table>
  119. <tr class="header">
  120. <td class="methodName">name</td>
  121. <td>returns</td>
  122. <td>description</td>
  123. </tr>
  124. <tr>
  125. <td>setSize(<br>&nbsp;&nbsp;&nbsp;<code><i>String width</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>String
  126. height</i></code><br>)
  127. </td>
  128. <td class="mid">none</td>
  129. <td>Set the size of the canvas. This is automatically done on a window resize.</td>
  130. </tr>
  131. <tr>
  132. <td>canvasToDOM({<br>&nbsp;&nbsp;&nbsp;<code><i>x: Number</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>y:
  133. Number</i></code><br>})
  134. </td>
  135. <td class="mid">Object</td>
  136. <td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of
  137. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  138. </td>
  139. </tr>
  140. <tr>
  141. <td>DOMtoCanvas({<br>&nbsp;&nbsp;&nbsp;<code><i>x: Number</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>y:
  142. Number</i></code><br>})
  143. </td>
  144. <td class="mid">Object</td>
  145. <td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of
  146. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  147. </td>
  148. </tr>
  149. </table>
  150. <h3>Events</h3>
  151. <p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
  152. <table>
  153. <tr class="header">
  154. <td class="eventName">name</td>
  155. <td class="eventProperties">properties</td>
  156. <td>description</td>
  157. </tr>
  158. <tr>
  159. <td>resize</td>
  160. <td class="mid">
  161. <pre class="code">
  162. {
  163. width: Number // the new width of the canvas
  164. height: Number // the new height of the canvas
  165. oldWidth: Number // the old width of the canvas
  166. oldHeight: Number // the old height of the canvas
  167. }
  168. </pre>
  169. <ul>
  170. </ul>
  171. </td>
  172. <td>Fired when the size of the canvas has been resized, either by a redraw call when the container div has
  173. changed in size, a setSize() call with new values or a setOptions() with new width and/or height values.
  174. </td>
  175. </tr>
  176. </table>
  177. <br/>
  178. <br/>
  179. <br/>
  180. <br/>
  181. <br/>
  182. <br/>
  183. <br/>
  184. </div>
  185. <!-- Bootstrap core JavaScript
  186. ================================================== -->
  187. <!-- Placed at the end of the document so the pages load faster -->
  188. <script src="../js/jquery.min.js"></script>
  189. <script src="../js/bootstrap.min.js"></script>
  190. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  191. <script src="../js/ie10-viewport-bug-workaround.js"></script>