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.

869 lines
27 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
9 years ago
9 years ago
9 years ago
9 years ago
  1. <!DOCTYPE html>
  2. <html lang="en"><head>
  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>graph3d - vis.js - A dynamic, browser based visualization library.</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. <script type="text/javascript" src="../js/toggleTable.js"></script>
  28. </head>
  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="http://www.visjs.org/index.html#modules">Modules</a></li>
  47. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  48. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  49. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  50. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  51. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  52. </ul>
  53. <form class="navbar-form navbar-right" role="search">
  54. <input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
  55. <button type="submit" class="btn btn-default">Go!</button>
  56. </form>
  57. <div id="search-results-wrapper" class="panel panel-default">
  58. <div class="panel-body">
  59. <div id="tipue_search_content"></div>
  60. </div>
  61. </div>
  62. <div id="keyword-info" class="panel panel-success">
  63. <div class="panel-body">
  64. Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </nav>
  70. </div>
  71. </div>
  72. <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>
  73. <div class="container full">
  74. <h1>Graph3d</h1>
  75. <h2 id="Overview">Overview</h2>
  76. <p>
  77. Graph3d is an interactive visualization chart to draw data in a three dimensional
  78. graph. You can freely move and zoom in the graph by dragging and scrolling in the
  79. window. Graph3d also supports animation of a graph.
  80. </p>
  81. <p>
  82. Graph3d uses <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Canvas">HTML canvas</a>
  83. to render graphs, and can render up to a few thousands of data points smoothly.
  84. </p>
  85. <h2 id="Contents">Contents</h2>
  86. <ul>
  87. <li><a href="#Overview">Overview</a></li>
  88. <li><a href="#Loading">Loading</a></li>
  89. <li><a href="#Data_Format">Data Format</a></li>
  90. <li><a href="#Configuration_Options">Configuration Options</a></li>
  91. <li><a href="#Methods">Methods</a></li>
  92. <li><a href="#Events">Events</a></li>
  93. <li><a href="#Data_Policy">Data Policy</a></li>
  94. </ul>
  95. <h2 id="Example">Example</h2>
  96. <p>
  97. The following code shows how to create a Graph3d and provide it with data.
  98. More examples can be found in the <a href="../examples">examples</a> directory.
  99. </p>
  100. <pre class="prettyprint lang-html">
  101. &lt;!DOCTYPE HTML&gt;
  102. &lt;html&gt;
  103. &lt;head&gt;
  104. &lt;title&gt;Graph 3D demo&lt;/title&gt;
  105. &lt;style&gt;
  106. body {font: 10pt arial;}
  107. &lt;/style&gt;
  108. &lt;script type="text/javascript" src="../../dist/vis.js"&gt;&lt;/script&gt;
  109. &lt;script type="text/javascript"&gt;
  110. var data = null;
  111. var graph = null;
  112. function custom(x, y) {
  113. return (Math.sin(x/50) * Math.cos(y/50) * 50 + 50);
  114. }
  115. // Called when the Visualization API is loaded.
  116. function drawVisualization() {
  117. // Create and populate a data table.
  118. var data = new vis.DataSet();
  119. // create some nice looking data with sin/cos
  120. var steps = 50; // number of datapoints will be steps*steps
  121. var axisMax = 314;
  122. var axisStep = axisMax / steps;
  123. for (var x = 0; x &lt; axisMax; x+=axisStep) {
  124. for (var y = 0; y &lt; axisMax; y+=axisStep) {
  125. var value = custom(x, y);
  126. data.add({
  127. x: x,
  128. y: y,
  129. z: value,
  130. style: value
  131. });
  132. }
  133. }
  134. // specify options
  135. var options = {
  136. width: '600px',
  137. height: '600px',
  138. style: 'surface',
  139. showPerspective: true,
  140. showGrid: true,
  141. showShadow: false,
  142. keepAspectRatio: true,
  143. verticalRatio: 0.5
  144. };
  145. // create a graph3d
  146. var container = document.getElementById('mygraph');
  147. graph3d = new vis.Graph3d(container, data, options);
  148. }
  149. &lt;/script&gt;
  150. &lt;/head&gt;
  151. &lt;body onload="drawVisualization();"&gt;
  152. &lt;div id="mygraph"&gt;&lt;/div&gt;
  153. &lt;/body&gt;
  154. &lt;/html&gt;
  155. </pre>
  156. <h2 id="Loading">Loading</h2>
  157. <p>
  158. The class name of the Graph3d is <code>vis.Graph3d</code>.
  159. When constructing a Graph3d, an HTML DOM container must be provided to attach
  160. the graph to. Optionally, data and options can be provided.
  161. Data is a vis <code>DataSet</code> or an <code>Array</code>, described in
  162. section <a href="#Data_Format">Data Format</a>.
  163. Options is a name-value map in the JSON format. The available options
  164. are described in section <a href="#Configuration_Options">Configuration Options</a>.
  165. </p>
  166. <pre class="prettyprint lang-js">var graph = new vis.Graph3d(container [, data] [, options]);</pre>
  167. <p>
  168. Data and options can be set or changed later on using the functions
  169. <code>Graph3d.setData(data)</code> and <code>Graph3d.setOptions(options)</code>.
  170. </p>
  171. <h2 id="Data_Format">Data Format</h2>
  172. <p>
  173. Graph3d can load data from an <code>Array</code>, a <code>DataSet</code> (offering 2 way data binding), or a <code>DataView</code> (offering 1 way data binding).
  174. JSON objects are added to this DataSet by using the <code>add()</code> function.
  175. Data points must have properties <code>x</code>, <code>y</code>, and <code>z</code>,
  176. and can optionally have a property <code>style</code> and <code>filter</code>.
  177. <h3>Definition</h3>
  178. <p>
  179. The DataSet JSON objects are defined as:
  180. </p>
  181. <table class="properties">
  182. <tr>
  183. <th>Name</th>
  184. <th>Type</th>
  185. <th>Required</th>
  186. <th>Description</th>
  187. </tr>
  188. <tr>
  189. <td>x</td>
  190. <td>number</td>
  191. <td>yes</td>
  192. <td>Location on the x-axis.</td>
  193. </tr>
  194. <tr>
  195. <td>y</td>
  196. <td>number</td>
  197. <td>yes</td>
  198. <td>Location on the y-axis.</td>
  199. </tr>
  200. <tr>
  201. <td>z</td>
  202. <td>number</td>
  203. <td>yes</td>
  204. <td>Location on the z-axis.</td>
  205. </tr>
  206. <tr>
  207. <td>style</td>
  208. <td>number</td>
  209. <td>no</td>
  210. <td>The data value, required for graph styles <code>dot-color</code> and
  211. <code>dot-size</code>.
  212. </td>
  213. </tr>
  214. <tr>
  215. <td>filter</td>
  216. <td>*</td>
  217. <td>no</td>
  218. <td>Filter values used for the animation.
  219. This column may have any type, such as a number, string, or Date.</td>
  220. </tr>
  221. </table>
  222. <h2 id="Configuration_Options">Configuration Options</h2>
  223. <p>
  224. Options can be used to customize the graph. Options are defined as a JSON object.
  225. All options are optional.
  226. </p>
  227. <pre class="prettyprint lang-js">
  228. var options = {
  229. width: '100%',
  230. height: '400px',
  231. style: 'surface'
  232. };
  233. </pre>
  234. <p>
  235. The following options are available.
  236. </p>
  237. <table class="options">
  238. <tr>
  239. <th>Name</th>
  240. <th>Type</th>
  241. <th>Default</th>
  242. <th>Description</th>
  243. </tr>
  244. <tr>
  245. <td>animationInterval</td>
  246. <td>number</td>
  247. <td>1000</td>
  248. <td>The animation interval in milliseconds. This determines how fast
  249. the animation runs.</td>
  250. </tr>
  251. <tr>
  252. <td>animationPreload</td>
  253. <td>boolean</td>
  254. <td>false</td>
  255. <td>If false, the animation frames are loaded as soon as they are requested.
  256. if <code>animationPreload</code> is true, the graph will automatically load
  257. all frames in the background, resulting in a smoother animation as soon as
  258. all frames are loaded. The load progress is shown on screen.</td>
  259. </tr>
  260. <tr>
  261. <td>animationAutoStart</td>
  262. <td>boolean</td>
  263. <td>false</td>
  264. <td>If true, the animation starts playing automatically after the graph
  265. is created.</td>
  266. </tr>
  267. <tr>
  268. <td>axisColor</td>
  269. <td>string</td>
  270. <td>'#4D4D4D'</td>
  271. <td>The color of the axis lines and the text along the axis.</td>
  272. </tr>
  273. <tr>
  274. <td>backgroundColor</td>
  275. <td>string or Object</td>
  276. <td>{fill:&nbsp;'white', stroke:&nbsp;'gray', strokeWidth:&nbsp;1}</td>
  277. <td>The background color for the main area of the chart.
  278. Can be either a simple HTML color string, for example: 'red' or '#00cc00',
  279. or an object with the following properties.</td>
  280. </tr>
  281. <tr>
  282. <td>backgroundColor.fill</td>
  283. <td>string</td>
  284. <td>'white'</td>
  285. <td>The chart fill color, as an HTML color string.</td>
  286. </tr>
  287. <tr>
  288. <td>backgroundColor.stroke</td>
  289. <td>string</td>
  290. <td>'gray'</td>
  291. <td>The color of the chart border, as an HTML color string.</td>
  292. </tr>
  293. <tr>
  294. <td>backgroundColor.strokeWidth</td>
  295. <td>number</td>
  296. <td>1</td>
  297. <td>The border width, in pixels.</td>
  298. </tr>
  299. <tr>
  300. <td>cameraPosition</td>
  301. <td>Object</td>
  302. <td>{horizontal:&nbsp;1.0, vertical:&nbsp;0.5, distance:&nbsp;1.7}</td>
  303. <td>Set the initial rotation and position of the camera.
  304. The object <code>cameraPosition</code> contains three parameters:
  305. <code>horizontal</code>, <code>vertical</code>, and <code>distance</code>.
  306. Parameter <code>horizontal</code> is a value in radians and can have any
  307. value (but normally in the range of 0 and 2*Pi).
  308. Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi.
  309. Parameter <code>distance</code> is the (normalized) distance from the
  310. camera to the center of the graph, in the range of 0.71 to 5.0. A
  311. larger distance puts the graph further away, making it smaller.
  312. All parameters are optional.
  313. </tr>
  314. <tr>
  315. <td>dataColor</td>
  316. <td>string or object</td>
  317. <td>{fill:&nbsp;'#7DC1FF', stroke:&nbsp;'#3267D2', strokeWidth:&nbsp;1}</td>
  318. <td>When <code>dataColor</code> is a string, it will set the color for both border and fill color of dots and bars. Applicable for styles <code>dot-size</code>, <code>bar-size</code>, and <code>line</code>. When an object, it can contain the properties descibed below.</td>
  319. </tr>
  320. <tr>
  321. <td>dataColor.fill</td>
  322. <td>string</td>
  323. <td>'#7DC1FF'</td>
  324. <td>The fill color of the dots or bars. Applicable when using styles <code>dot-size</code>, <code>bar-size</code>, or <code>line</code>.</td>
  325. </tr>
  326. <tr>
  327. <td>dataColor.stroke</td>
  328. <td>string</td>
  329. <td>'#3267D2'</td>
  330. <td>The border color of the dots or bars. Applicable when using styles <code>dot-size</code> or <code>bar-size</code>.</td>
  331. </tr>
  332. <tr>
  333. <td>dataColor.strokeWidth</td>
  334. <td>number</td>
  335. <td>1</td>
  336. <td>The line width of dots, bars and lines. Applicable for all styles.</td>
  337. </tr>
  338. <tr>
  339. <td>dotSizeRatio</td>
  340. <td>number</td>
  341. <td>0.02</td>
  342. <td>Ratio of the size of the dots with respect to the width of the graph.</td>
  343. </tr>
  344. <tr>
  345. <td>gridColor</td>
  346. <td>string</td>
  347. <td>'#D3D3D3'</td>
  348. <td>The color of the grid lines.</td>
  349. </tr>
  350. <tr>
  351. <td>height</td>
  352. <td>string</td>
  353. <td>'400px'</td>
  354. <td>The height of the graph in pixels or as a percentage.</td>
  355. </tr>
  356. <tr>
  357. <td>keepAspectRatio</td>
  358. <td>boolean</td>
  359. <td>true</td>
  360. <td>If <code>keepAspectRatio</code> is true, the x-axis and the y-axis
  361. keep their aspect ratio. If false, the axes are scaled such that they
  362. both have the same, maximum with.</td>
  363. </tr>
  364. <tr>
  365. <td>showAnimationControls</td>
  366. <td>boolean</td>
  367. <td>true</td>
  368. <td>If true, animation controls are created at the bottom of the Graph.
  369. The animation controls consists of buttons previous, start/stop, next,
  370. and a slider showing the current frame.
  371. Only applicable when the provided data contains an animation.</td>
  372. </tr>
  373. <tr>
  374. <td>showGrid</td>
  375. <td>boolean</td>
  376. <td>true</td>
  377. <td>If true, grid lines are drawn in the x-y surface (the bottom of the 3d
  378. graph).</td>
  379. </tr>
  380. <tr>
  381. <td>showXAxis</td>
  382. <td>boolean</td>
  383. <td>true</td>
  384. <td>If true, X axis and X axis labels are drawn.</td>
  385. </tr>
  386. <tr>
  387. <td>showYAxis</td>
  388. <td>boolean</td>
  389. <td>true</td>
  390. <td>If true, Y axis and Y axis labels are drawn.</td>
  391. </tr>
  392. <tr>
  393. <td>showZAxis</td>
  394. <td>boolean</td>
  395. <td>true</td>
  396. <td>If true, Z axis and Z axis labels are drawn.</td>
  397. </tr>
  398. <tr>
  399. <td>showPerspective</td>
  400. <td>boolean</td>
  401. <td>true</td>
  402. <td>If true, the graph is drawn in perspective: points and lines which
  403. are further away are drawn smaller.
  404. Note that the graph currently does not support a gray colored bottom side
  405. when drawn in perspective.
  406. </td>
  407. </tr>
  408. <tr>
  409. <td>showLegend</td>
  410. <td>boolean</td>
  411. <td>none</td>
  412. <td>If true, a legend is drawn for the graph (if the graph type supports it).
  413. By default a legend is drawn for dot and dot-color style graphs.
  414. </td>
  415. </tr>
  416. <tr>
  417. <td>showShadow</td>
  418. <td>boolean</td>
  419. <td>false</td>
  420. <td>Show shadow on the graph.</td>
  421. </tr>
  422. <tr>
  423. <td>style</td>
  424. <td>string</td>
  425. <td>'dot'</td>
  426. <td>The style of the 3d graph. Available styles:
  427. <code>bar</code>,
  428. <code>bar-color</code>,
  429. <code>bar-size</code>,
  430. <code>dot</code>,
  431. <code>dot-line</code>,
  432. <code>dot-color</code>,
  433. <code>dot-size</code>,
  434. <code>line</code>,
  435. <code>grid</code>,
  436. or <code>surface</code></td>
  437. </tr>
  438. <tr>
  439. <td>tooltip</td>
  440. <td>boolean | function</td>
  441. <td>false</td>
  442. <td>Show a tooltip showing the values of the hovered data point.
  443. The contents of the tooltip can be customized by providing a callback
  444. function as <code>tooltip</code>. In this case the function is called
  445. with an object containing parameters <code>x</code>,
  446. <code>y</code>, <code>z</code>, and <code>data</code>
  447. (the source JS object for the point) as an argument,
  448. and must return a string which may contain HTML.
  449. </td>
  450. </tr>
  451. <tr>
  452. <td>tooltipStyle</td>
  453. <td>Object</td>
  454. <td>
  455. <pre class="prettyprint lang-js">
  456. {
  457. content: {
  458. padding: '10px',
  459. border: '1px solid #4d4d4d',
  460. color: '#1a1a1a',
  461. background: 'rgba(255,255,255,0.7)',
  462. borderRadius: '2px',
  463. boxShadow: '5px 5px 10px rgba(128,128,128,0.5)'
  464. },
  465. line: {
  466. height: '40px',
  467. width: '0',
  468. borderLeft: '1px solid #4d4d4d'
  469. },
  470. dot: {
  471. height: '0',
  472. width: '0',
  473. border: '5px solid #4d4d4d',
  474. borderRadius: '5px'
  475. }
  476. }</pre>
  477. </td>
  478. <td>Tooltip style properties.
  479. Provided properties will be merged with the default object.
  480. </td>
  481. </tr>
  482. <tr>
  483. <td>valueMax</td>
  484. <td>number</td>
  485. <td>none</td>
  486. <td>The maximum value for the value-axis. Only available in combination
  487. with the styles <code>dot-color</code> and <code>dot-size</code>.</td>
  488. </tr>
  489. <tr>
  490. <td>valueMin</td>
  491. <td>number</td>
  492. <td>none</td>
  493. <td>The minimum value for the value-axis. Only available in combination
  494. with the styles <code>dot-color</code> and <code>dot-size</code>.</td>
  495. </tr>
  496. <tr>
  497. <td>verticalRatio</td>
  498. <td>number</td>
  499. <td>0.5</td>
  500. <td>A value between 0.1 and 1.0. This scales the vertical size of the graph
  501. When keepAspectRatio is set to false, and verticalRatio is set to 1.0,
  502. the graph will be a cube.</td>
  503. </tr>
  504. <tr>
  505. <td>width</td>
  506. <td>string</td>
  507. <td>'400px'</td>
  508. <td>The width of the graph in pixels or as a percentage.</td>
  509. </tr>
  510. <tr>
  511. <td>xBarWidth</td>
  512. <td>number</td>
  513. <td>none</td>
  514. <td>The width of bars in x direction. By default, the width is equal to the smallest distance
  515. between the data points.
  516. Only applicable for styles <code>'bar'</code> and <code>'bar-color'</code>.</td>
  517. </tr>
  518. <tr>
  519. <td>xCenter</td>
  520. <td>string</td>
  521. <td>'55%'</td>
  522. <td>The horizontal center position of the graph, as a percentage or in
  523. pixels.</td>
  524. </tr>
  525. <tr>
  526. <td>xMax</td>
  527. <td>number</td>
  528. <td>from data</td>
  529. <td>The maximum value for the x-axis.
  530. If not set, the largest value for x in the data set is used.
  531. </td>
  532. </tr>
  533. <tr>
  534. <td>xMin</td>
  535. <td>number</td>
  536. <td>from data</td>
  537. <td>The minimum value for the x-axis.
  538. If not set, the smallest value for x in the data set is used.
  539. </td>
  540. </tr>
  541. <tr>
  542. <td>xStep</td>
  543. <td>number</td>
  544. <td>none</td>
  545. <td>Step size for the grid on the x-axis.</td>
  546. </tr>
  547. <tr>
  548. <td>xValueLabel</td>
  549. <td>function</td>
  550. <td>none</td>
  551. <td>A function for custom formatting of the labels along the x-axis,
  552. for example <code>function (x) {return (x * 100) + '%'}</code>.
  553. </td>
  554. </tr>
  555. <tr>
  556. <td>yBarWidth</td>
  557. <td>number</td>
  558. <td>none</td>
  559. <td>The width of bars in y direction. By default, the width is equal to the smallest distance
  560. between the data points.
  561. Only applicable for styles <code>'bar'</code> and <code>'bar-color'</code>.</td>
  562. </tr>
  563. <tr>
  564. <td>yCenter</td>
  565. <td>string</td>
  566. <td>'45%'</td>
  567. <td>The vertical center position of the graph, as a percentage or in
  568. pixels.</td>
  569. </tr>
  570. <tr>
  571. <td>yMax</td>
  572. <td>number</td>
  573. <td>from data</td>
  574. <td>The maximum value for the y-axis.
  575. If not set, the largest value for y in the data set is used.
  576. </td>
  577. </tr>
  578. <tr>
  579. <td>yMin</td>
  580. <td>number</td>
  581. <td>from data</td>
  582. <td>The minimum value for the y-axis.
  583. If not set, the smallest value for y in the data set is used.
  584. </td>
  585. </tr>
  586. <tr>
  587. <td>yStep</td>
  588. <td>number</td>
  589. <td>none</td>
  590. <td>Step size for the grid on the y-axis.</td>
  591. </tr>
  592. <tr>
  593. <td>yValueLabel</td>
  594. <td>function</td>
  595. <td>none</td>
  596. <td>A function for custom formatting of the labels along the y-axis,
  597. for example <code>function (y) {return (y * 100) + '%'}</code>.
  598. </td>
  599. </tr>
  600. <tr>
  601. <td>zMax</td>
  602. <td>number</td>
  603. <td>from data</td>
  604. <td>The maximum value for the z-axis.
  605. If not set, the largest value for z in the data set is used.
  606. </td>
  607. </tr>
  608. <tr>
  609. <td>zMin</td>
  610. <td>number</td>
  611. <td>from data</td>
  612. <td>The minimum value for the z-axis.
  613. If not set, the smallest value for z in the data set is used.
  614. </td>
  615. </tr>
  616. <tr>
  617. <td>zStep</td>
  618. <td>number</td>
  619. <td>none</td>
  620. <td>Step size for the grid on the z-axis.</td>
  621. </tr>
  622. <tr>
  623. <td>zValueLabel</td>
  624. <td>function</td>
  625. <td>none</td>
  626. <td>A function for custom formatting of the labels along the z-axis,
  627. for example <code>function (z) {return (z * 100) + '%'}</code>.
  628. </td>
  629. </tr>
  630. <tr>
  631. <td>xLabel</td>
  632. <td>String</td>
  633. <td>x</td>
  634. <td>Label on the X axis.</td>
  635. </tr>
  636. <tr>
  637. <td>yLabel</td>
  638. <td>String</td>
  639. <td>y</td>
  640. <td>Label on the Y axis.</td>
  641. </tr>
  642. <tr>
  643. <td>zLabel</td>
  644. <td>String</td>
  645. <td>z</td>
  646. <td>Label on the Z axis.</td>
  647. </tr>
  648. <tr>
  649. <td>filterLabel</td>
  650. <td>String</td>
  651. <td>time</td>
  652. <td>Label for the filter column.</td>
  653. </tr>
  654. <tr>
  655. <td>legendLabel</td>
  656. <td>String</td>
  657. <td>value</td>
  658. <td>Label for the style description.</td>
  659. </tr>
  660. </table>
  661. <h2 id="Methods">Methods</h2>
  662. <p>
  663. Graph3d supports the following methods.
  664. </p>
  665. <table class="methods">
  666. <tr>
  667. <th>Method</th>
  668. <th>Return Type</th>
  669. <th>Description</th>
  670. </tr>
  671. <tr>
  672. <td>animationStart()</td>
  673. <td>none</td>
  674. <td>Start playing the animation.
  675. Only applicable when animation data is available.</td>
  676. </tr>
  677. <tr>
  678. <td>animationStop()</td>
  679. <td>none</td>
  680. <td>Stop playing the animation.
  681. Only applicable when animation data is available.</td>
  682. </tr>
  683. <tr>
  684. <td>getCameraPosition()</td>
  685. <td>An object with parameters <code>horizontal</code>,
  686. <code>vertical</code> and <code>distance</code></td>
  687. <td>Returns an object with parameters <code>horizontal</code>,
  688. <code>vertical</code> and <code>distance</code>,
  689. which each one of them is a number, representing the rotation and position
  690. of the camera.</td>
  691. </tr>
  692. <tr>
  693. <td>redraw()</td>
  694. <td>none</td>
  695. <td>Redraw the graph. Useful after the camera position is changed externally,
  696. when data is changed, or when the layout of the webpage changed.</td>
  697. </tr>
  698. <tr>
  699. <td>setData(data)</td>
  700. <td>none</td>
  701. <td>Replace the data in the Graph3d.</td>
  702. </tr>
  703. <tr>
  704. <td>setOptions(options)</td>
  705. <td>none</td>
  706. <td>Update options of Graph3d.
  707. The provided options will be merged with current options.</td>
  708. </tr>
  709. <tr>
  710. <td>setSize(width, height)</td>
  711. <td>none</td>
  712. <td>Parameters <code>width</code> and <code>height</code> are strings,
  713. containing a new size for the graph. Size can be provided in pixels
  714. or in percentages.</td>
  715. </tr>
  716. <tr>
  717. <td>setCameraPosition (pos)</td>
  718. <td>{horizontal:&nbsp;1.0, vertical:&nbsp;0.5, distance:&nbsp;1.7}</td>
  719. <td>Set the rotation and position of the camera. Parameter <code>pos</code>
  720. is an object which contains three parameters: <code>horizontal</code>,
  721. <code>vertical</code>, and <code>distance</code>.
  722. Parameter <code>horizontal</code> is a value in radians and can have any
  723. value (but normally in the range of 0 and 2*Pi).
  724. Parameter <code>vertical</code> is a value in radians between 0 and 0.5*Pi.
  725. Parameter <code>distance</code> is the (normalized) distance from the
  726. camera to the center of the graph, in the range of 0.71 to 5.0. A
  727. larger distance puts the graph further away, making it smaller.
  728. All parameters are optional.
  729. </td>
  730. </tr>
  731. </table>
  732. <h2 id="Events">Events</h2>
  733. <p>
  734. Graph3d fires events after the camera position has been changed.
  735. The event can be catched by creating a listener.
  736. Here an example on how to catch a <code>cameraPositionChange</code> event.
  737. </p>
  738. <pre class="prettyprint lang-js">
  739. function onCameraPositionChange(event) {
  740. alert('The camera position changed to:\n' +
  741. 'Horizontal: ' + event.horizontal + '\n' +
  742. 'Vertical: ' + event.vertical + '\n' +
  743. 'Distance: ' + event.distance);
  744. }
  745. // assuming var graph3d = new vis.Graph3d(document.getElementById('mygraph'));
  746. graph3d.on('cameraPositionChange', onCameraPositionChange);
  747. </pre>
  748. <p>
  749. The following events are available.
  750. </p>
  751. <table class="events">
  752. <tr>
  753. <th>name</th>
  754. <th>Properties</th>
  755. <th>Description</th>
  756. </tr>
  757. <tr>
  758. <td>cameraPositionChange</td>
  759. <td>
  760. <ul>
  761. <li><code>horizontal</code>: Number. The horizontal angle of the camera.</li>
  762. <li><code>vertical</code>: Number. The vertical angle of the camera.</li>
  763. <li><code>distance</code>: Number. The distance of the camera to the center of the graph.</li>
  764. </ul>
  765. </td>
  766. <td>The camera position changed. Fired after the user modified the camera position
  767. by moving (dragging) the graph, or by zooming (scrolling),
  768. but not after a call to <code>setCameraPosition</code> method.
  769. The new camera position can be retrieved by calling the method
  770. <code>getCameraPosition</code>.</td>
  771. </tr>
  772. </table>
  773. <h2 id="Data_Policy">Data Policy</h2>
  774. <p>
  775. All code and data are processed and rendered in the browser. No data is sent to any server.
  776. </p>
  777. </div>
  778. <!-- Bootstrap core JavaScript
  779. ================================================== -->
  780. <!-- Placed at the end of the document so the pages load faster -->
  781. <script src="../js/jquery.min.js"></script>
  782. <script src="../js/bootstrap.min.js"></script>
  783. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  784. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  785. <!-- jquery extensions -->
  786. <script src="../js/jquery.highlight.js"></script>
  787. <script src="../js/jquery.url.min.js"></script>
  788. <!-- Tipue vendor js -->
  789. <script src="../js/tipuesearch.config.js"></script>
  790. <script src="../js/tipuesearch.js"></script>
  791. <!-- controller -->
  792. <script src="../js/main.js"></script>