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.

1836 lines
70 KiB

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>timeline - 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. <!-- Tipue vendor css -->
  28. <link href="../css/tipuesearch.css" rel="stylesheet">
  29. <!-- Tipue vendor css -->
  30. <link href="../css/tipuesearch.css" rel="stylesheet">
  31. <script type="text/javascript" src="../js/toggleTable.js"></script>
  32. </head>
  33. <body onload="prettyPrint();">
  34. <div class="navbar-wrapper">
  35. <div class="container">
  36. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  37. <div class="container">
  38. <div class="navbar-header">
  39. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  40. aria-expanded="false" aria-controls="navbar">
  41. <span class="sr-only">Toggle navigation</span>
  42. <span class="icon-bar"></span>
  43. <span class="icon-bar"></span>
  44. <span class="icon-bar"></span>
  45. </button>
  46. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  47. </div>
  48. <div id="navbar" class="navbar-collapse collapse">
  49. <ul class="nav navbar-nav">
  50. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></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>Timeline</h1>
  66. <h2 id="Overview">Overview</h2>
  67. <p>
  68. The Timeline is an interactive visualization chart to visualize data in time.
  69. The data items can take place on a single date, or have a start and end date (a range).
  70. You can freely move and zoom in the timeline by dragging and scrolling in the
  71. Timeline. Items can be created, edited, and deleted in the timeline.
  72. The time scale on the axis is adjusted automatically, and supports scales ranging
  73. from milliseconds to years.
  74. </p>
  75. <p>
  76. Timeline uses regular HTML DOM to render the timeline and items put on the
  77. timeline. This allows for flexible customization using css styling.
  78. </p>
  79. <h2 id="Contents">Contents</h2>
  80. <ul>
  81. <li><a href="#Overview">Overview</a></li>
  82. <li><a href="#Example">Example</a></li>
  83. <li><a href="#Loading">Loading</a></li>
  84. <li><a href="#Data_Format">Data Format</a>
  85. <ul>
  86. <li><a href="#items">Items</a></li>
  87. <li><a href="#groups">Groups</a></li>
  88. </ul>
  89. </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="#Editing_Items">Editing Items</a></li>
  94. <li><a href="#Templates">Templates</a></li>
  95. <li><a href="#Localization">Localization</a></li>
  96. <li><a href="#Time_zone">Time zone</a></li>
  97. <li><a href="#Styles">Styles</a></li>
  98. </ul>
  99. <h2 id="Example">Example</h2>
  100. <p>
  101. The following code shows how to create a Timeline and provide it with data.
  102. More examples can be found in the <a href="../../timeline_examples.html">timeline examples</a> page.
  103. </p>
  104. <pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt;
  105. &lt;html&gt;
  106. &lt;head&gt;
  107. &lt;title&gt;Timeline | Basic demo&lt;/title&gt;
  108. &lt;style type="text/css"&gt;
  109. body, html {
  110. font-family: sans-serif;
  111. }
  112. &lt;/style&gt;
  113. &lt;script src="../../dist/vis.js"&gt;&lt;/script&gt;
  114. &lt;link href="../../dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  115. &lt;/head&gt;
  116. &lt;body&gt;
  117. &lt;div id="visualization"&gt;&lt;/div&gt;
  118. &lt;script type="text/javascript"&gt;
  119. // DOM element where the Timeline will be attached
  120. var container = document.getElementById('visualization');
  121. // Create a DataSet (allows two way data-binding)
  122. var items = new vis.DataSet([
  123. {id: 1, content: 'item 1', start: '2013-04-20'},
  124. {id: 2, content: 'item 2', start: '2013-04-14'},
  125. {id: 3, content: 'item 3', start: '2013-04-18'},
  126. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  127. {id: 5, content: 'item 5', start: '2013-04-25'},
  128. {id: 6, content: 'item 6', start: '2013-04-27'}
  129. ]);
  130. // Configuration for the Timeline
  131. var options = {};
  132. // Create a Timeline
  133. var timeline = new vis.Timeline(container, items, options);
  134. &lt;/script&gt;
  135. &lt;/body&gt;
  136. &lt;/html&gt;
  137. </pre>
  138. <h2 id="Loading">Loading</h2>
  139. <p>
  140. Install or download the <a href="http://visjs.org" target="_blank">vis.js</a> library
  141. in a subfolder of your project. Include the library's script and css files in the
  142. head of your html code:
  143. </p>
  144. <pre class="prettyprint lang-html">
  145. &lt;script src="vis/dist/vis.js"&gt;&lt;/script&gt;
  146. &lt;link href="vis/dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  147. </pre>
  148. The constructor of the Timeline is <code>vis.Timeline</code>
  149. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, options);</pre>
  150. or when using groups:
  151. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, groups, options);</pre>
  152. The constructor accepts four parameters:
  153. <ul>
  154. <li>
  155. <code>container</code> is the DOM element in which to create the timeline.
  156. </li>
  157. <li>
  158. <code>items</code> is an Array containing items. The properties of an
  159. item are described in section <a href="#Data_Format">Data Format, items</a>.
  160. </li><li>
  161. <code>groups</code> is an Array containing groups. The properties of a
  162. group are described in section <a href="#groups">Data Format, groups</a>.
  163. </li>
  164. <li>
  165. <code>options</code> is an optional Object containing a name-value map
  166. with options. Options can also be set using the method
  167. <code>setOptions</code>.
  168. </li>
  169. </ul>
  170. <h2 id="Data_Format">Data Format</h2>
  171. <p>
  172. The timeline can be provided with two types of data:
  173. </p>
  174. <ul>
  175. <li><a href="#items">Items</a> containing a set of items to be displayed in time.</li>
  176. <li><a href="#groups">Groups</a> containing a set of groups used to group items
  177. together.</li>
  178. </ul>
  179. <h3 id="items">Items</h3>
  180. <p>
  181. For items, the Timeline accepts an Array, a DataSet (offering 2 way data binding),
  182. or a DataView (offering 1 way data binding).
  183. Items are regular objects and can contain the properties <code>start</code>,
  184. <code>end</code> (optional), <code>content</code>,
  185. <code>group</code> (optional), <code>className</code> (optional),
  186. <code>editable</code> (optional), and <code>style</code> (optional).
  187. </p>
  188. <p>
  189. A DataSet is constructed as:
  190. </p>
  191. <pre class="prettyprint lang-js">
  192. var items = new vis.DataSet([
  193. {
  194. start: new Date(2010, 7, 15),
  195. end: new Date(2010, 8, 2), // end is optional
  196. content: 'Trajectory A'
  197. // Optional: fields 'id', 'type', 'group', 'className', 'style'
  198. }
  199. // more items...
  200. ]);
  201. </pre>
  202. <p>
  203. The item properties are defined as:
  204. </p>
  205. <table class="properties">
  206. <tr>
  207. <th>Name</th>
  208. <th>Type</th>
  209. <th>Required</th>
  210. <th>Description</th>
  211. </tr>
  212. <tr>
  213. <td>className</td>
  214. <td>String</td>
  215. <td>no</td>
  216. <td>This field is optional. A className can be used to give items
  217. an individual css style. For example, when an item has className
  218. 'red', one can define a css style like:
  219. <pre class="prettyprint lang-css">
  220. .vis-item.red {
  221. color: white;
  222. background-color: red;
  223. border-color: darkred;
  224. }</pre>
  225. More details on how to style items can be found in the section
  226. <a href="#Styles">Styles</a>.
  227. </td>
  228. </tr>
  229. <tr>
  230. <td>content</td>
  231. <td>String</td>
  232. <td>yes</td>
  233. <td>The contents of the item. This can be plain text or html code.</td>
  234. </tr>
  235. <tr>
  236. <td>end</td>
  237. <td>Date or number or string or Moment</td>
  238. <td>no</td>
  239. <td>The end date of the item. The end date is optional, and can be left <code>null</code>.
  240. If end date is provided, the item is displayed as a range.
  241. If not, the item is displayed as a box.</td>
  242. </tr>
  243. <tr>
  244. <td>group</td>
  245. <td>any type</td>
  246. <td>no</td>
  247. <td>This field is optional. When the group column is provided,
  248. all items with the same group are placed on one line.
  249. A vertical axis is displayed showing the groups.
  250. Grouping items can be useful for example when showing availability of multiple
  251. people, rooms, or other resources next to each other.<br>
  252. </td>
  253. </tr>
  254. <tr>
  255. <td>id</td>
  256. <td>String or Number</td>
  257. <td>no</td>
  258. <td>An id for the item. Using an id is not required but highly
  259. recommended. An id is needed when dynamically adding, updating,
  260. and removing items in a DataSet.</td>
  261. </tr>
  262. <tr>
  263. <td>start</td>
  264. <td>Date or number or string or Moment</td>
  265. <td>yes</td>
  266. <td>The start date of the item, for example <code>new Date(2010,9,23)</code>.</td>
  267. </tr>
  268. <tr>
  269. <td>style</td>
  270. <td>String</td>
  271. <td>no</td>
  272. <td>
  273. A css text string to apply custom styling for an individual item, for
  274. example <code>"color: red; background-color: pink;"</code>.
  275. </td>
  276. </tr>
  277. <tr>
  278. <td>subgroup</td>
  279. <td>String or Number</td>
  280. <td>none</td>
  281. <td>The id of a subgroup.
  282. Groups all items within a group per subgroup, and positions them on the
  283. same height instead of staking them on top of each other. can be ordered
  284. by specifying the option <code>subgroupOrder</code> of a group.
  285. </td>
  286. </tr>
  287. <tr>
  288. <td>title</td>
  289. <td>String</td>
  290. <td>none</td>
  291. <td>Add a title for the item, displayed when holding the mouse on the item.
  292. The title can only contain plain text.
  293. </td>
  294. </tr>
  295. <tr>
  296. <td>type</td>
  297. <td>String</td>
  298. <td>no</td>
  299. <td>The type of the item. Can be 'box' (default), 'point', 'range', or 'background'.
  300. Types 'box' and 'point' need a start date, the types 'range' and 'background' needs both a start and end date.
  301. </td>
  302. </tr>
  303. <tr>
  304. <td>editable</td>
  305. <td>Boolean</td>
  306. <td>no</td>
  307. <td>Override the editable option of the timeline for a specific item.</td>
  308. </table>
  309. <h3 id="groups">Groups</h3>
  310. <p>
  311. For the items, groups can be an Array, a DataSet (offering 2 way data binding),
  312. or a DataView (offering 1 way data binding).
  313. Using groups, items can be grouped together.
  314. Items are filtered per group, and displayed as
  315. Group items can contain the properties <code>id</code>,
  316. <code>content</code>, and <code>className</code> (optional).
  317. </p>
  318. <p>
  319. Groups can be applied to a timeline using the method <code>setGroups</code> or supplied in the constructor.
  320. A table with groups can be created like:
  321. </p>
  322. <pre class="prettyprint lang-js">
  323. var groups = [
  324. {
  325. id: 1,
  326. content: 'Group 1'
  327. // Optional: a field 'className', 'style'
  328. }
  329. // more groups...
  330. ]);
  331. </pre>
  332. <p>
  333. Groups can have the following properties:
  334. </p>
  335. <table class="properties">
  336. <tr>
  337. <th>Name</th>
  338. <th>Type</th>
  339. <th>Required</th>
  340. <th>Description</th>
  341. </tr>
  342. <tr>
  343. <td>className</td>
  344. <td>String</td>
  345. <td>no</td>
  346. <td>This field is optional. A className can be used to give groups
  347. an individual css style. For example, when a group has className
  348. 'red', one can define a css style
  349. <code>
  350. .red {
  351. color: red;
  352. }
  353. </code>.
  354. More details on how to style groups can be found in the section
  355. <a href="#Styles">Styles</a>.
  356. </td>
  357. </tr>
  358. <tr>
  359. <td>content</td>
  360. <td>String</td>
  361. <td>yes</td>
  362. <td>The contents of the group. This can be plain text or html code.</td>
  363. </tr>
  364. <tr>
  365. <td>id</td>
  366. <td>String or Number</td>
  367. <td>yes</td>
  368. <td>An id for the group. The group will display all items having a
  369. property <code>group</code> which matches the <code>id</code>
  370. of the group.</td>
  371. </tr>
  372. <tr>
  373. <td>style</td>
  374. <td>String</td>
  375. <td>no</td>
  376. <td>
  377. A css text string to apply custom styling for an individual group label, for
  378. example <code>"color: red; background-color: pink;"</code>.
  379. </td>
  380. </tr>
  381. <tr>
  382. <td>subgroupOrder</td>
  383. <td>String or Function</td>
  384. <td>none</td>
  385. <td>Order the subgroups by a field name or custom sort function.
  386. By default, groups are ordered by first-come, first-show.
  387. </td>
  388. </tr>
  389. <tr>
  390. <td>title</td>
  391. <td>String</td>
  392. <td>none</td>
  393. <td>A title for the group, displayed when holding the mouse on the groups label.
  394. The title can only contain plain text.
  395. </td>
  396. </tr>
  397. </table>
  398. <h2 id="Configuration_Options">Configuration Options</h2>
  399. <p>
  400. Options can be used to customize the timeline.
  401. Options are defined as a JSON object. All options are optional.
  402. </p>
  403. <pre class="prettyprint lang-js">
  404. var options = {
  405. width: '100%',
  406. height: '30px',
  407. margin: {
  408. item: 20
  409. }
  410. };
  411. </pre>
  412. <p>
  413. The following options are available.
  414. </p>
  415. <table class="options" id="optionTable">
  416. <tr>
  417. <th>Name</th>
  418. <th>Type</th>
  419. <th>Default</th>
  420. <th>Description</th>
  421. </tr>
  422. <tr>
  423. <td>align</td>
  424. <td>String</td>
  425. <td><code>'center'</code></td>
  426. <td>Alignment of items with type 'box', 'range', and 'background'. Available values are 'auto' (default), 'center', 'left', or 'right'. For 'box' items, the 'auto' alignment is 'center'. For 'range' items, the auto alignment is dynamic: positioned left and shifted such that the contents is always visible on screen.</td>
  427. </tr>
  428. <tr>
  429. <td>autoResize</td>
  430. <td>boolean</td>
  431. <td><code>true</code></td>
  432. <td>If true, the Timeline will automatically detect when its container is resized, and redraw itself accordingly. If false, the Timeline can be forced to repaint after its container has been resized using the function <code>redraw()</code>.</td>
  433. </tr>
  434. <tr>
  435. <td>clickToUse</td>
  436. <td>boolean</td>
  437. <td><code>false</code></td>
  438. <td>When a Timeline is configured to be <code>clickToUse</code>, it will react to mouse and touch events only when active.
  439. When active, a blue shadow border is displayed around the Timeline. The Timeline is set active by clicking on it, and is changed to inactive again by clicking outside the Timeline or by pressing the ESC key.</td>
  440. </tr>
  441. <tr>
  442. <td>configure</td>
  443. <td>boolean or function</td>
  444. <td><code>false</code></td>
  445. <td>When true, a configurator is loaded where all configuration options of the Timeline can be changed live.
  446. The displayed options can be filtered by providing a filter function. This function is invoked with two arguments: the current <code>option</code> and the <code>path</code> (an Array) of the option within the options object. The option will be displayed when the filter function returns true. For example to only display format options:
  447. <pre class="prettyprint lang-js">
  448. function (option, path) {
  449. return option === 'format' || path.indexOf('format') !== -1;
  450. }</pre>
  451. </td>
  452. </tr>
  453. <tr>
  454. <td>dataAttributes</td>
  455. <td>string[] or 'all'</string></td>
  456. <td><code>false</code></td>
  457. <td>An array of fields optionally defined on the timeline items that will be appended as <code>data-</code> attributes to the DOM element of the items.<br>
  458. If value is <code>'all'</code> then each field defined on the timeline item will become a <code>data-</code> attribute.</td>
  459. </tr>
  460. <tr class='toggle collapsible' onclick="toggleTable('optionTable','editable', this);">
  461. <td><span parent="editable" class="right-caret"></span> editable</td>
  462. <td>boolean or Object</td>
  463. <td><code>false</code></td>
  464. <td>If true, the items in the timeline can be manipulated. Only applicable when option <code>selectable</code> is <code><code>true</code></code>. See also the callbacks <code>onAdd</code>, <code>onUpdate</code>, <code>onMove</code>, and <code>onRemove</code>. When <code>editable</code> is an object, one can enable or disable individual manipulation actions.
  465. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  466. </td>
  467. </tr>
  468. <tr parent="editable" class="hidden">
  469. <td class="indent">editable.add</td>
  470. <td>boolean</td>
  471. <td><code>false</code></td>
  472. <td>If true, new items can be created by double tapping an empty space in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  473. </tr>
  474. <tr parent="editable" class="hidden">
  475. <td class="indent">editable.remove</td>
  476. <td>boolean</td>
  477. <td><code>false</code></td>
  478. <td>If true, items can be deleted by first selecting them, and then clicking the delete button on the top right of the item. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  479. </tr>
  480. <tr parent="editable" class="hidden">
  481. <td class="indent">editable.updateGroup</td>
  482. <td>boolean</td>
  483. <td><code>false</code></td>
  484. <td>If true, items can be dragged from one group to another. Only applicable when the Timeline has groups. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  485. </tr>
  486. <tr parent="editable" class="hidden">
  487. <td class="indent">editable.updateTime</td>
  488. <td>boolean</td>
  489. <td><code>false</code></td>
  490. <td>If true, items can be dragged to another moment in time. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
  491. </tr>
  492. <tr>
  493. <td>end</td>
  494. <td>Date or Number or String or Moment</td>
  495. <td>none</td>
  496. <td>The initial end date for the axis of the timeline.
  497. If not provided, the latest date present in the items set is taken as
  498. end date.</td>
  499. </tr>
  500. <tr>
  501. <td>format</td>
  502. <td>Object</td>
  503. <td>none</td>
  504. <td>
  505. Apply custom date formatting of the labels on the time axis. The default value of <code>format</code> is:
  506. <pre class="prettyprint lang-js">{
  507. minorLabels: {
  508. millisecond:'SSS',
  509. second: 's',
  510. minute: 'HH:mm',
  511. hour: 'HH:mm',
  512. weekday: 'ddd D',
  513. day: 'D',
  514. month: 'MMM',
  515. year: 'YYYY'
  516. },
  517. majorLabels: {
  518. millisecond:'HH:mm:ss',
  519. second: 'D MMMM HH:mm',
  520. minute: 'ddd D MMMM',
  521. hour: 'ddd D MMMM',
  522. weekday: 'MMMM YYYY',
  523. day: 'MMMM YYYY',
  524. month: 'YYYY',
  525. year: ''
  526. }
  527. }</pre>
  528. For values which not provided in the customized <code>options.format</code>, the default values will be used.
  529. All available formatting syntax is described in the <a href="http://momentjs.com/docs/#/displaying/format/">docs of moment.js</a>.
  530. </td>
  531. </tr>
  532. <tr class='toggle collapsible' onclick="toggleTable('optionTable','groupEditable', this);">
  533. <td><span parent="groupEditable" class="right-caret"></span> groupEditable</td>
  534. <td>boolean or Object</td>
  535. <td><code>false</code></td>
  536. <td>If true, the groups in the timeline can be manipulated. See also the callbacks <code>onAddGroup</code>, <code>onMoveGroup</code>, and <code>onRemoveGroup</code>. When <code>groupEditable</code> is an object, one can enable or disable individual manipulation actions.
  537. The editing of groups follows the same principles as for items, see section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  538. </td>
  539. </tr>
  540. <tr parent="groupEditable" class="hidden">
  541. <td class="indent">groupEditable.add</td>
  542. <td>boolean</td>
  543. <td><code>false</code></td>
  544. <td>If true, new groups can be created in the Timeline. For now adding new groups is done by the user.</td>
  545. </tr>
  546. <tr parent="groupEditable" class="hidden">
  547. <td class="indent">groupEditable.remove</td>
  548. <td>boolean</td>
  549. <td><code>false</code></td>
  550. <td>If true, groups can be deleted. For now removing groups is done by the user.</td>
  551. </tr>
  552. <tr parent="groupEditable" class="hidden">
  553. <td class="indent">groupEditable.order</td>
  554. <td>boolean</td>
  555. <td><code>false</code></td>
  556. <td>If true, groups can be dragged to change their order. Only applicable when the Timeline has groups. For this option to work properly the groupOrder and groupOrderSwap options have to be set as well.</td>
  557. </tr>
  558. <tr>
  559. <td>groupOrder</td>
  560. <td>String or Function</td>
  561. <td>'order'</td>
  562. <td>Order the groups by a field name or custom sort function.
  563. By default, groups are ordered by a property <code>order</code> (if set).
  564. If no <code>order</code> properties are provided, the order will be undetermined.
  565. </td>
  566. </tr>
  567. <tr>
  568. <td>groupOrderSwap</td>
  569. <td>Function</td>
  570. <td>none</td>
  571. <td>Swaps the positions of two groups. If groups have a custom order (via <code>groupOrder</code>) and groups are configured to be reorderable (via <code>groupEditable.order</code>), the user has to provide a function that swaps the positions of two given groups.
  572. If this option is not set, the default implementation assumes that groups hold an attribute <code>order</code> which values are changed. The signature of the <code>groupOrderWap</code> function is:
  573. <pre class="prettyprint lang-js">function groupOrderSwap(fromGroup: Object, toGroup: Object, groups: DataSet)</pre>
  574. The first to arguments hold the groups of which the positions are to be swapped and the third argument holds the DataSet with all groups.
  575. </td>
  576. </tr>
  577. <tr>
  578. <td>groupTemplate</td>
  579. <td>function</td>
  580. <td>none</td>
  581. <td>A template function used to generate the contents of the groups. The function is called by the Timeline with a groups data as argument, and must return HTML code as result. When the option groupTemplate is specified, the groups do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
  582. </tr>
  583. <tr>
  584. <td>height</td>
  585. <td>number or String</td>
  586. <td>none</td>
  587. <td>The height of the timeline in pixels or as a percentage.
  588. When height is undefined or null, the height of the timeline is automatically
  589. adjusted to fit the contents.
  590. It is possible to set a maximum height using option <code>maxHeight</code>
  591. to prevent the timeline from getting too high in case of automatically
  592. calculated height.
  593. </td>
  594. </tr>
  595. <tr>
  596. <td>hiddenDates</td>
  597. <td>Object</td>
  598. <td>none</td>
  599. <td>This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object:
  600. <code>{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00', [repeat:'daily']}</code> or as an Array of these objects. The repeat argument is optional.
  601. The possible values are (case-sensitive): <code>daily, weekly, monthly, yearly</code>. To hide a weekend, pick any Saturday as start and the following Monday as end
  602. and set repeat to weekly.
  603. </td>
  604. </tr>
  605. <tr>
  606. <td>itemsAlwaysDraggable</td>
  607. <td>boolean</td>
  608. <td><code>false</code></td>
  609. <td>If true, all items in the Timeline are draggable without being selected. If false, only the selected item(s) are draggable.</td>
  610. </tr>
  611. <tr>
  612. <td>locale</td>
  613. <td>String</td>
  614. <td>none</td>
  615. <td>Select a locale for the Timeline. See section <a href="#Localization">Localization</a> for more information.</td>
  616. </tr>
  617. <tr>
  618. <td>locales</td>
  619. <td>Object</td>
  620. <td>none</td>
  621. <td>A map with i18n locales. See section <a href="#Localization">Localization</a> for more information.</td>
  622. </tr>
  623. <tr>
  624. <td>moment</td>
  625. <td>function</td>
  626. <td>vis.moment</td>
  627. <td>A constructor for creating a moment.js Date. Allows for applying a custom time zone. See section <a href="#Time_zone">Time zone</a> for more information.</td>
  628. </tr>
  629. <tr class='toggle collapsible' onclick="toggleTable('optionTable','margin', this);">
  630. <td><span parent="margin" class="right-caret"></span> margin</td>
  631. <td>number or Object</td>
  632. <td>Object</td>
  633. <td>When a number, applies the margin to <code>margin.axis</code>, <code>margin.item.horizontal</code>, and <code>margin.item.vertical</code>.</td>
  634. </tr>
  635. <tr parent="margin" class="hidden">
  636. <td class="indent">margin.axis</td>
  637. <td>number</td>
  638. <td><code>20</code></td>
  639. <td>The minimal margin in pixels between items and the time axis.</td>
  640. </tr>
  641. <tr parent="margin" class="hidden">
  642. <td class="indent">margin.item</td>
  643. <td>number</td>
  644. <td><code>10</code></td>
  645. <td>The minimal margin in pixels between items in both horizontal and vertical direction.</td>
  646. </tr>
  647. <tr parent="margin" class="hidden">
  648. <td class="indent2">margin.item.horizontal</td>
  649. <td>number</td>
  650. <td><code>10</code></td>
  651. <td>The minimal horizontal margin in pixels between items.</td>
  652. </tr>
  653. <tr parent="margin" class="hidden">
  654. <td class="indent2">margin.item.vertical</td>
  655. <td>number</td>
  656. <td><code>10</code></td>
  657. <td>The minimal vertical margin in pixels between items.</td>
  658. </tr>
  659. <tr>
  660. <td>max</td>
  661. <td>Date or Number or String or Moment</td>
  662. <td>none</td>
  663. <td>Set a maximum Date for the visible range.
  664. It will not be possible to move beyond this maximum.
  665. </td>
  666. </tr>
  667. <tr>
  668. <td>maxHeight</td>
  669. <td>number or String</td>
  670. <td>none</td>
  671. <td>Specifies the maximum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  672. </tr>
  673. <tr>
  674. <td>maxMinorChars</td>
  675. <td>number</td>
  676. <td>7</td>
  677. <td>
  678. Specifies the maximum number of characters that should fit in minor grid labels.
  679. If larger, less and wider grids will be drawn.
  680. </td>
  681. </tr>
  682. <tr>
  683. <td>min</td>
  684. <td>Date or Number or String or Moment</td>
  685. <td>none</td>
  686. <td>Set a minimum Date for the visible range.
  687. It will not be possible to move beyond this minimum.
  688. </td>
  689. </tr>
  690. <tr>
  691. <td>minHeight</td>
  692. <td>number or String</td>
  693. <td>none</td>
  694. <td>Specifies the minimum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  695. </tr>
  696. <tr>
  697. <td>moveable</td>
  698. <td>boolean</td>
  699. <td><code>true</code></td>
  700. <td>
  701. Specifies whether the Timeline can be moved and zoomed by dragging the window.
  702. See also option <code>zoomable</code>.
  703. </td>
  704. </tr>
  705. <tr>
  706. <td>multiselect</td>
  707. <td>boolean</td>
  708. <td><code>false</code></td>
  709. <td>
  710. If true, multiple items can be selected using ctrl+click, shift+click, or by holding items.
  711. Only applicable when option <code>selectable</code> is <code>true</code>.
  712. </td>
  713. </tr>
  714. <tr>
  715. <td style="font-size: 0.9em">multiselectPerGroup</td>
  716. <td>boolean</td>
  717. <td><code>false</code></td>
  718. <td>
  719. If true, selecting multiple items using shift+click will only select items residing in the same group as the <i>first</i> selected item.
  720. Only applicable when option <code>selectable</code> and <code>multiselect</code> are <code>true</code>.
  721. </td>
  722. </tr>
  723. <tr>
  724. <td>onAdd</td>
  725. <td>function</td>
  726. <td>none</td>
  727. <td>Callback function triggered when an item is about to be added: when the user double taps an empty space in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.add</code> are set <code><code>true</code></code>.
  728. </td>
  729. </tr>
  730. <tr>
  731. <td>onAddGroup</td>
  732. <td>function</td>
  733. <td>none</td>
  734. <td>Callback function triggered when a group is about to be added. The signature and semantics are the same as for <code>onAdd</code>.
  735. </td>
  736. </tr>
  737. <tr>
  738. <td>onUpdate</td>
  739. <td>function</td>
  740. <td>none</td>
  741. <td>Callback function triggered when an item is about to be updated, when the user double taps an item in the Timeline. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code><code>true</code></code>.
  742. </td>
  743. </tr>
  744. <tr>
  745. <td>onMove</td>
  746. <td>function</td>
  747. <td>none</td>
  748. <td>Callback function triggered when an item has been moved: after the user has dragged the item to an other position. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code><code>true</code></code>.
  749. </td>
  750. </tr>
  751. <tr>
  752. <td>onMoveGroup</td>
  753. <td>function</td>
  754. <td>none</td>
  755. <td>Callback function triggered when a group has been moved: after the user has dragged the group to an other position. The signature and semantics are the same as for <code>onMove</code>.
  756. </td>
  757. </tr>
  758. <tr>
  759. <td>onMoving</td>
  760. <td>function</td>
  761. <td>none</td>
  762. <td>Callback function triggered repeatedly when an item is being moved. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code><code>true</code></code>.
  763. </td>
  764. </tr>
  765. <tr>
  766. <td>onRemove</td>
  767. <td>function</td>
  768. <td>none</td>
  769. <td>Callback function triggered when an item is about to be removed: when the user tapped the delete button on the top right of a selected item. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.remove</code> are set <code><code>true</code></code>.
  770. </td>
  771. </tr>
  772. <tr>
  773. <td>onRemoveGroup</td>
  774. <td>function</td>
  775. <td>none</td>
  776. <td>Callback function triggered when a group is about to be removed. The signature and semantics are the same as for <code>onRemove</code>.
  777. </td>
  778. </tr>
  779. <tr>
  780. <td>order</td>
  781. <td>function</td>
  782. <td>none</td>
  783. <td>
  784. <p>Provide a custom sort function to order the items. The order of the
  785. items is determining the way they are stacked. The function
  786. order is called with two arguments containing the data of two items to be
  787. compared.
  788. </p>
  789. <p style="font-style: italic">WARNING: Use with caution. Custom ordering is not suitable for large amounts of items. On load, the Timeline will render all items once to determine their width and height. Keep the number of items in this configuration limited to a maximum of a few hundred items.</p>
  790. </td>
  791. </tr>
  792. <tr class='toggle collapsible' onclick="toggleTable('optionTable','orientation', this);">
  793. <td><span parent="orientation" class="right-caret"></span> orientation</td>
  794. <td>String or Object</td>
  795. <td><code>'bottom'</code></td>
  796. <td>Orientation of the timelines axis and items. When orientation is a string, the value is applied to both items and axis. Can be 'top', 'bottom' (default), 'both', or 'none'.</td>
  797. </tr>
  798. <tr parent="orientation" class="hidden">
  799. <td class="indent">orientation.axis</td>
  800. <td>String</td>
  801. <td><code>'bottom'</code></td>
  802. <td>Orientation of the timeline axis: 'top', 'bottom' (default), 'both', or 'none'. If orientation is 'bottom', the time axis is drawn at the bottom. When 'top', the axis is drawn on top. When 'both', two axes are drawn, both on top and at the bottom. In case of 'none', no axis is drawn at all.</td>
  803. </tr>
  804. <tr parent="orientation" class="hidden">
  805. <td class="indent">orientation.item</td>
  806. <td>String</td>
  807. <td><code>'bottom'</code></td>
  808. <td>Orientation of the timeline items: 'top' or 'bottom' (default). Determines whether items are aligned to the top or bottom of the Timeline.</td>
  809. </tr>
  810. <tr>
  811. <td>rtl</td>
  812. <td>boolean</td>
  813. <td><code>false</code></td>
  814. <td>If true, the timeline will be right-to-left.</td>
  815. </tr>
  816. <tr>
  817. <td>selectable</td>
  818. <td>boolean</td>
  819. <td><code>true</code></td>
  820. <td>If true, the items on the timeline can be selected. Multiple items can be selected by long pressing them, or by using ctrl+click or shift+click. The event <code>select</code> is fired each time the selection has changed (see section <a href="#Events">Events</a>).</td>
  821. </tr>
  822. <tr>
  823. <td>showCurrentTime</td>
  824. <td>boolean</td>
  825. <td><code>true</code></td>
  826. <td>Show a vertical bar at the current time.</td>
  827. </tr>
  828. <tr>
  829. <tr>
  830. <td>showMajorLabels</td>
  831. <td>boolean</td>
  832. <td><code>true</code></td>
  833. <td>By default, the timeline shows both minor and major date labels on the
  834. time axis.
  835. For example the minor labels show minutes and the major labels show hours.
  836. When <code>showMajorLabels</code> is <code><code>false</code></code>, no major labels
  837. are shown.</td>
  838. </tr>
  839. <tr>
  840. <td>showMinorLabels</td>
  841. <td>boolean</td>
  842. <td><code>true</code></td>
  843. <td>By default, the timeline shows both minor and major date labels on the
  844. time axis.
  845. For example the minor labels show minutes and the major labels show hours.
  846. When <code>showMinorLabels</code> is <code><code>false</code></code>, no minor labels
  847. are shown. When both <code>showMajorLabels</code> and
  848. <code>showMinorLabels</code> are false, no horizontal axis will be
  849. visible.</td>
  850. </tr>
  851. <tr>
  852. <td>stack</td>
  853. <td>boolean</td>
  854. <td><code>true</code></td>
  855. <td>If true (default), items will be stacked on top of each other such that they do not overlap.</td>
  856. </tr>
  857. <tr>
  858. <td>snap</td>
  859. <td>function or null</td>
  860. <td>function</td>
  861. <td>When moving items on the Timeline, they will be snapped to nice dates like full hours or days, depending on the current scale. The <code>snap</code> function can be replaced with a custom function, or can be set to <code>null</code> to disable snapping. The signature of the snap function is:
  862. <pre class="prettyprint lang-js">function snap(date: Date, scale: string, step: number) : Date or number</pre>
  863. The parameter <code>scale</code> can be can be 'millisecond', 'second', 'minute', 'hour', 'weekday, 'day, 'month, or 'year'. The parameter <code>step</code> is a number like 1, 2, 4, 5.
  864. </td>
  865. </tr>
  866. <tr>
  867. <td>start</td>
  868. <td>Date or Number or String or Moment</td>
  869. <td>none</td>
  870. <td>The initial start date for the axis of the timeline.
  871. If not provided, the earliest date present in the events is taken as start date.</td>
  872. </tr>
  873. <tr>
  874. <td>template</td>
  875. <td>function</td>
  876. <td>none</td>
  877. <td>A template function used to generate the contents of the items. The function is called by the Timeline with an items data as argument, and must return HTML code as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
  878. </tr>
  879. <tr>
  880. <td>throttleRedraw</td>
  881. <td>number</td>
  882. <td><code>0</code></td>
  883. <td>Limit the maximum number of redraws to once every x milliseconds. For example setting throttleRedraw to `100` milliseconds will limit the number of redraws to 10 times per second.</td>
  884. </tr>
  885. <tr class='toggle collapsible' onclick="toggleTable('optionTable','timeAxis', this);">
  886. <td><span parent="timeAxis" class="right-caret"></span> timeAxis</td>
  887. <td>Object</td>
  888. <td><code>Object</code></td>
  889. <td>Specify a fixed scale and step size for the time axis.</td>
  890. </tr>
  891. <tr parent="timeAxis" class="hidden">
  892. <td class="indent">timeAxis.scale</td>
  893. <td>String</td>
  894. <td>none</td>
  895. <td>Set a fixed scale for the time axis of the Timeline. Choose from <code>'millisecond'</code>, <code>'second'</code>, <code>'minute'</code>, <code>'hour'</code>, <code>'weekday'</code>, <code>'day'</code>, <code>'month'</code>, <code>'year'</code>. Example usage:
  896. <pre class="prettyprint lang-js">var options = {
  897. timeAxis: {scale: 'minute', step: 5}
  898. }</pre>
  899. </td>
  900. </tr>
  901. <tr parent="timeAxis" class="hidden">
  902. <td class="indent">timeAxis.step</td>
  903. <td>number</td>
  904. <td><code>1</code></td>
  905. <td>
  906. Set a fixed step size for the time axis. Only applicable when used together with <code>timeAxis.scale</code>.
  907. Choose for example 1, 2, 5, or 10.</td>
  908. </tr>
  909. <tr>
  910. <td>type</td>
  911. <td>String</td>
  912. <td>none</td>
  913. <td>Specifies the default type for the timeline items. Choose from 'box', 'point', 'range', and 'background'. Note that individual items can override this default type. If undefined, the Timeline will auto detect the type from the items data: if a start and end date is available, a 'range' will be created, and else, a 'box' is created. Items of type 'background' are not editable.
  914. </td>
  915. </tr>
  916. <tr>
  917. <td>width</td>
  918. <td>String or Number</td>
  919. <td><code>'100%'</code></td>
  920. <td>The width of the timeline in pixels or as a percentage.</td>
  921. </tr>
  922. <tr>
  923. <td>zoomable</td>
  924. <td>boolean</td>
  925. <td><code>true</code></td>
  926. <td>
  927. Specifies whether the Timeline can be zoomed by pinching or scrolling in the window.
  928. Only applicable when option <code>moveable</code> is set <code><code>true</code></code>.
  929. </td>
  930. </tr>
  931. <tr>
  932. <td>zoomKey</td>
  933. <td>String</td>
  934. <td><code>''</code></td>
  935. <td>Specifies whether the Timeline is only zoomed when an additional key is down.
  936. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'.
  937. Only applicable when option <code>moveable</code> is set <code><code>true</code></code>.
  938. </td>
  939. </tr>
  940. <tr>
  941. <td>zoomMax</td>
  942. <td>number</td>
  943. <td><code>315360000000000</code></td>
  944. <td>Set a maximum zoom interval for the visible range in milliseconds.
  945. It will not be possible to zoom out further than this maximum.
  946. Default value equals about 10000 years.
  947. </td>
  948. </tr>
  949. <tr>
  950. <td>zoomMin</td>
  951. <td>number</td>
  952. <td><code>10</code></td>
  953. <td>Set a minimum zoom interval for the visible range in milliseconds.
  954. It will not be possible to zoom in further than this minimum.
  955. </td>
  956. </tr>
  957. </table>
  958. <h2 id="Methods">Methods</h2>
  959. <p>
  960. The Timeline supports the following methods.
  961. </p>
  962. <table class="methods">
  963. <tr>
  964. <th>Method</th>
  965. <th>Return&nbsp;Type</th>
  966. <th>Description</th>
  967. </tr>
  968. <tr>
  969. <td>addCustomTime([time] [, id])</td>
  970. <td>number or String</td>
  971. <td>
  972. Add new vertical bar representing a custom time that can be dragged by the user.
  973. Parameter <code>time</code> can be a Date, Number, or String, and is <code>new Date()</code> by default.
  974. Parameter <code>id</code> can be Number or String and is <code>undefined</code> by default.
  975. The <code>id</code>code> is added as CSS class name of the custom time bar, allowing to style multiple time bars differently.
  976. The method returns id of the created bar.
  977. </td>
  978. </tr>
  979. <tr>
  980. <td>destroy()</td>
  981. <td>none</td>
  982. <td>Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
  983. </td>
  984. </tr>
  985. <tr>
  986. <td>fit([options])</td>
  987. <td>none</td>
  988. <td>Adjust the visible window such that it fits all items. See also function <code>focus(id)</code>.
  989. Available options:
  990. <ul>
  991. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.
  992. </li>
  993. </ul>
  994. </td>
  995. </tr>
  996. <tr>
  997. <td>focus(id or ids [, options])</td>
  998. <td>none</td>
  999. <td>Adjust the visible window such that the selected item (or multiple items) are centered on screen. See also function <code>fit()</code>. Available options:
  1000. <ul>
  1001. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1002. </ul>
  1003. </td>
  1004. </tr>
  1005. <tr>
  1006. <td>getCurrentTime()</td>
  1007. <td>Date</td>
  1008. <td>Get the current time. Only applicable when option <code>showCurrentTime</code> is true.
  1009. </td>
  1010. </tr>
  1011. <tr>
  1012. <td>getCustomTime([id])</td>
  1013. <td>Date</td>
  1014. <td>Retrieve the custom time from the custom time bar with given id. Id is <code>undefined</code> by default.
  1015. </td>
  1016. </tr>
  1017. <tr id="getEventProperties">
  1018. <td>getEventProperties(event)</td>
  1019. <td>Object</td>
  1020. <td>
  1021. Returns an Object with relevant properties from an event:
  1022. <ul>
  1023. <li><code>group</code> (Number or null): the id of the clicked group.</li>
  1024. <li><code>item</code> (Number or null): the id of the clicked item.</li>
  1025. <li><code>pageX</code> (Number): absolute horizontal position of the click event.</li>
  1026. <li><code>pageY</code> (Number): absolute vertical position of the click event.</li>
  1027. <li><code>x</code> (Number): relative horizontal position of the click event.</li>
  1028. <li><code>y</code> (Number): relative vertical position of the click event.</li>
  1029. <li><code>time</code> (Date): Date of the clicked event.</li>
  1030. <li><code>snappedTime</code> (Date): Date of the clicked event, snapped to a nice value.</li>
  1031. <li><code>what</code> (String or null): name of the clicked thing: <code>item</code>, <code>background</code>, <code>axis</code>, <code>group-label</code>, <code>custom-time</code>, or <code>current-time</code>.</li>
  1032. <li><code>event</code> (Object): the original click event.</li>
  1033. </ul>
  1034. Example usage:
  1035. <pre class="prettyprint lang-js">
  1036. document.getElementById('myTimeline').onclick = function (event) {
  1037. var props = timeline.getEventProperties(event)
  1038. console.log(props);
  1039. }</pre>
  1040. </td>
  1041. </tr>
  1042. <tr>
  1043. <td>getItemRange()</td>
  1044. <td>Object</td>
  1045. <td>Get the range of all the items as an object containing <code>min: Date</code> and <code>max: Date</code>.</td>
  1046. </tr>
  1047. <tr>
  1048. <td>getSelection()</td>
  1049. <td>number[]</td>
  1050. <td>Get an array with the ids of the currently selected items.</td>
  1051. </tr>
  1052. <tr>
  1053. <td>getVisibleItems()</td>
  1054. <td>number[]</td>
  1055. <td>Get an array with the ids of the currently visible items.</td>
  1056. </tr>
  1057. <tr>
  1058. <td>getWindow()</td>
  1059. <td>Object</td>
  1060. <td>Get the current visible window. Returns an object with properties <code>start: Date</code> and <code>end: Date</code>.</td>
  1061. </tr>
  1062. <tr>
  1063. <td>moveTo(time [, options])</td>
  1064. <td>none</td>
  1065. <td>Move the window such that given time is centered on screen. Parameter <code>time</code> can be a <code>Date</code>, <code>Number</code>, or <code>String</code>. Available options:
  1066. <ul>
  1067. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1068. </ul>
  1069. </td>
  1070. </tr>
  1071. <tr>
  1072. <td>on(event, callback)</td>
  1073. <td>none</td>
  1074. <td>Create an event listener. The callback function is invoked every time the event is triggered. Avialable events: <code>rangechange</code>, <code>rangechanged</code>, <code>select</code>, <code>itemover</code>, <code>itemout</code>. The callback function is invoked as <code>callback(properties)</code>, where <code>properties</code> is an object containing event specific properties. See section <a href="#Events">Events for more information</a>.</td>
  1075. </tr>
  1076. <tr>
  1077. <td>off(event, callback)</td>
  1078. <td>none</td>
  1079. <td>Remove an event listener created before via function <code>on(event, callback)</code>. See section <a href="#Events">Events for more information</a>.</td>
  1080. </tr>
  1081. <tr>
  1082. <td>redraw()</td>
  1083. <td>none</td>
  1084. <td>Force a redraw of the Timeline. The size of all items will be recalculated.
  1085. Can be useful to manually redraw when option <code>autoResize=false</code> and the window
  1086. has been resized, or when the items CSS has been changed.
  1087. </td>
  1088. </tr>
  1089. <tr>
  1090. <td>removeCustomTime(id)</td>
  1091. <td>none</td>
  1092. <td>
  1093. Remove vertical bars previously added to the timeline via <code>addCustomTime</code> method. Parameter <code>id</code> is the ID of the custom vertical bar returned by <code>addCustomTime</code> method.
  1094. </td>
  1095. </tr>
  1096. <tr>
  1097. <td>setCurrentTime(time)</td>
  1098. <td>none</td>
  1099. <td>Set a current time. This can be used for example to ensure that a client's time is synchronized with a shared server time.
  1100. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1101. Only applicable when option <code>showCurrentTime</code> is true.</td>
  1102. </tr>
  1103. <tr>
  1104. <td>setCustomTime(time [, id])</td>
  1105. <td>none</td>
  1106. <td>Adjust the time of a custom time bar.
  1107. Parameter <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  1108. Parameter <code>id</code> is the idof the custom time bar, and is <code>undefined</code> by default.
  1109. </td>
  1110. </tr>
  1111. <tr>
  1112. <td>setCustomTimeTitle(title [, id])</td>
  1113. <td>none</td>
  1114. <td>Adjust the title attribute of a custom time bar.
  1115. Parameter <code>title</code> is the string to be set as title. Use empty string to hide the title completely.
  1116. Parameter <code>id</code> is the id of the custom time bar, and is <code>undefined</code> by default.
  1117. </td>
  1118. </tr>
  1119. <tr>
  1120. <td>setData({<br>&nbsp;&nbsp;groups: groups,<br>&nbsp;&nbsp;items: items<br>})</td>
  1121. <td>none</td>
  1122. <td>Set both groups and items at once. Both properties are optional. This is a convenience method for individually calling both <code>setItems(items)</code> and <code>setGroups(groups)</code>.
  1123. Both <code>items</code> and <code>groups</code> can be an Array with Objects,
  1124. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1125. For each of the groups, the items of the timeline are filtered on the
  1126. property <code>group</code>, which must correspond with the id of the group.
  1127. </td>
  1128. </tr>
  1129. <tr>
  1130. <td>setGroups(groups)</td>
  1131. <td>none</td>
  1132. <td>Set a data set with groups for the Timeline.
  1133. <code>groups</code> can be an Array with Objects,
  1134. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1135. For each of the groups, the items of the timeline are filtered on the
  1136. property <code>group</code>, which must correspond with the id of the group.
  1137. </td>
  1138. </tr>
  1139. <tr>
  1140. <td>setItems(items)</td>
  1141. <td>none</td>
  1142. <td>Set a data set with items for the Timeline.
  1143. <code>items</code> can be an Array with Objects,
  1144. a DataSet (offering 2 way data binding), or a DataView (offering 1 way data binding).
  1145. </td>
  1146. </tr>
  1147. <tr>
  1148. <td>setOptions(options)</td>
  1149. <td>none</td>
  1150. <td>Set or update options. It is possible to change any option of the timeline at any time. You can for example switch orientation on the fly.
  1151. </td>
  1152. </tr>
  1153. <tr>
  1154. <td>setSelection(id or ids [, options])</td>
  1155. <td>none</td>
  1156. <td>Select one or multiple items by their id. The currently selected items will be unselected. To unselect all selected items, call `setSelection([])`. Available options:
  1157. <ul>
  1158. <li><code>focus: boolean</code><br>If true, focus will be set to the selected item(s)</li>
  1159. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Only applicable when option focus is true. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1160. </ul>
  1161. </td>
  1162. </tr>
  1163. <tr>
  1164. <td>setWindow(start, end [, options])</td>
  1165. <td>none</td>
  1166. <td>Set the current visible window. The parameters <code>start</code> and <code>end</code> can be a <code>Date</code>, <code>Number</code>, or <code>String</code>. If the parameter value of <code>start</code> or <code>end</code> is null, the parameter will be left unchanged. Available options:
  1167. <ul>
  1168. <li><code>animation: boolean or {duration: number, easingFunction: string}</code><br>If true (default) or an Object, the range is animated smoothly to the new window. An object can be provided to specify duration and easing function. Default duration is 500 ms, and default easing function is <code>'easeInOutQuad'</code>. Available easing functions: <code>"linear"</code>, <code>"easeInQuad"</code>, <code>"easeOutQuad"</code>, <code>"easeInOutQuad"</code>, <code>"easeInCubic"</code>, <code>"easeOutCubic"</code>, <code>"easeInOutCubic"</code>, <code>"easeInQuart"</code>, <code>"easeOutQuart"</code>, <code>"easeInOutQuart"</code>, <code>"easeInQuint"</code>, <code>"easeOutQuint"</code>, <code>"easeInOutQuint"</code>.</li>
  1169. </ul>
  1170. </td>
  1171. </tr>
  1172. </table>
  1173. <h2 id="Events">Events</h2>
  1174. <p>
  1175. Timeline fires events when changing the visible window by dragging, when
  1176. selecting items, and when dragging the custom time bar.
  1177. </p>
  1178. <p>
  1179. Here an example on how to listen for a <code>select</code> event.
  1180. </p>
  1181. <pre class="prettyprint lang-js">
  1182. timeline.on('select', function (properties) {
  1183. alert('selected items: ' + properties.items);
  1184. });
  1185. </pre>
  1186. <p>
  1187. A listener can be removed via the function <code>off</code>:
  1188. </p>
  1189. <pre class="prettyprint lang-js">
  1190. function onSelect (properties) {
  1191. alert('selected items: ' + properties.items);
  1192. }
  1193. // add event listener
  1194. timeline.on('select', onSelect);
  1195. // do stuff...
  1196. // remove event listener
  1197. timeline.off('select', onSelect);
  1198. </pre>
  1199. <p>
  1200. The following events are available.
  1201. </p>
  1202. <table class="events">
  1203. <tr>
  1204. <th>Name</th>
  1205. <th>Properties</th>
  1206. <th>Description</th>
  1207. </tr>
  1208. <tr>
  1209. <td>currentTimeTick</td>
  1210. <td>Fired when the current time bar redraws. The rate depends on the zoom level.</td>
  1211. </tr>
  1212. <tr>
  1213. <td>click</td>
  1214. <td>
  1215. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1216. </td>
  1217. <td>Fired when clicked inside the Timeline.
  1218. </td>
  1219. </tr>
  1220. <tr>
  1221. <td>contextmenu</td>
  1222. <td>
  1223. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1224. </td>
  1225. <td>Fired when right-clicked inside the Timeline. Note that in order to prevent the context menu from showing up, default behavior of the event must be stopped:
  1226. <pre class="prettyprint lang-js">timeline.on('contextmenu', function (props) {
  1227. alert('Right click!');
  1228. props.event.preventDefault();
  1229. });
  1230. </pre>
  1231. </td>
  1232. </tr>
  1233. <tr>
  1234. <td>doubleClick</td>
  1235. <td>
  1236. Passes a properties object as returned by the method <a href="#getEventProperties"><code>Timeline.getEventProperties(event)</code></a>.
  1237. </td>
  1238. <td>Fired when double clicked inside the Timeline.
  1239. </td>
  1240. </tr>
  1241. <tr>
  1242. <td>groupDragged</td>
  1243. <td>
  1244. Passes the id of the dragged group.
  1245. </td>
  1246. <td>Fired after the dragging of a group is finished.
  1247. </td>
  1248. </tr>
  1249. <tr>
  1250. <td>changed</td>
  1251. <td>
  1252. Has no properties.
  1253. </td>
  1254. <td>Fired once after each graph redraw.
  1255. </td>
  1256. </tr>
  1257. <tr>
  1258. <td>rangechange</td>
  1259. <td>
  1260. <ul>
  1261. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1262. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1263. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1264. </ul>
  1265. </td>
  1266. <td>Fired repeatedly when the timeline window is being changed.
  1267. </td>
  1268. </tr>
  1269. <tr>
  1270. <td>rangechanged</td>
  1271. <td>
  1272. <ul>
  1273. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  1274. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  1275. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  1276. </ul>
  1277. </td>
  1278. <td>Fired once after the timeline window has been changed.
  1279. </td>
  1280. </tr>
  1281. <tr>
  1282. <td>select</td>
  1283. <td>
  1284. <ul>
  1285. <li><code>items</code>: an array with the ids of the selected items</li>
  1286. <li><code>event</code>: the original click event</li>
  1287. </ul>
  1288. </td>
  1289. <td>Fired after the user selects or deselects items by tapping or holding them.
  1290. When a use taps an already selected item, the select event is fired again.
  1291. Not fired when the method <code>setSelection</code>is executed.
  1292. </td>
  1293. </tr>
  1294. <tr>
  1295. <td>itemover</td>
  1296. <td>
  1297. <ul>
  1298. <li><code>item</code>: hovered item id</li>
  1299. <li><code>event</code>: the original mouseover event</li>
  1300. </ul>
  1301. </td>
  1302. <td>Fired when the user moves the mouse over an item.</td>
  1303. </tr>
  1304. <tr>
  1305. <td>itemout</td>
  1306. <td>
  1307. <ul>
  1308. <li><code>item</code>: hovered item id</li>
  1309. <li><code>event</code>: the original mouseout event</li>
  1310. </ul>
  1311. </td>
  1312. <td>Fired when the user moves the mouse out of an item.</td>
  1313. </tr>
  1314. <tr>
  1315. <td>timechange</td>
  1316. <td>
  1317. <ul>
  1318. <li><code>id</code> (Number or String): custom time bar id.</li>
  1319. <li><code>time</code> (Date): the custom time.</li>
  1320. </ul>
  1321. </td>
  1322. <td>Fired repeatedly when the user is dragging the custom time bar.
  1323. Only available when the custom time bar is enabled.
  1324. </td>
  1325. </tr>
  1326. <tr>
  1327. <td>timechanged</td>
  1328. <td>
  1329. <ul>
  1330. <li><code>id</code> (Number or String): custom time bar id.</li>
  1331. <li><code>time</code> (Date): the custom time.</li>
  1332. </ul>
  1333. </td>
  1334. <td>Fired once after the user has dragged the custom time bar.
  1335. Only available when the custom time bar is enabled.
  1336. </td>
  1337. </tr>
  1338. </table>
  1339. <h2 id="Editing_Items">Editing Items</h2>
  1340. <p>
  1341. When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code><code>true</code></code>), the user can:
  1342. </p>
  1343. <ul>
  1344. <li>Select an item by clicking it, and use ctrl+click to or shift+click to select multiple items (when <code>multiselect: true</code>).</li>
  1345. <li>Move selected items by dragging them.</li>
  1346. <li>Create a new item by double tapping on an empty space.</li>
  1347. <li>Create a new range item by dragging on an empty space with the ctrl key down.</li>
  1348. <li>Update an item by double tapping it.</li>
  1349. <li>Delete a selected item by clicking the delete button on the top right.</li>
  1350. </ul>
  1351. <p>Option <code>editable</code> accepts a boolean or an object. When <code>editable</code> is a boolean, all manipulation actions will be either enabled or disabled. When <code>editable</code> is an object, one can enable individual manipulation actions:</p>
  1352. <pre class="prettyprint lang-js">// enable or disable all manipulation actions
  1353. var options = {
  1354. editable: true // true or false
  1355. };
  1356. // enable or disable individual manipulation actions
  1357. var options = {
  1358. editable: {
  1359. add: true, // add new items by double tapping
  1360. updateTime: true, // drag items horizontally
  1361. updateGroup: true, // drag items from one group to another
  1362. remove: true // delete an item by tapping the delete button top right
  1363. }
  1364. };</pre>
  1365. <p>
  1366. Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option.
  1367. </p>
  1368. <pre class="prettyprint lang-js">
  1369. var items = new vis.DataSet([
  1370. {id: 1, content: 'read-only item', start: '2013-04-20', editable: false},
  1371. {id: 2, content: 'editable item', start: '2013-04-14'}
  1372. ]);
  1373. </pre>
  1374. <p>
  1375. One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose:
  1376. </p>
  1377. <ul>
  1378. <li><code>onAdd(item, callback)</code> Fired when a new item is about to be added. If not implemented, the item will be added with default text contents.</li>
  1379. <li><code>onUpdate(item, callback)</code> Fired when an item is about to be updated. This function typically has to show a dialog where the user change the item. If not implemented, nothing happens.</li>
  1380. <li><code>onMove(item, callback)</code> Fired when an item has been moved. If not implemented, the move action will be accepted.</li>
  1381. <li><code>onMoving(item, callback)</code> Fired repeatedly while an item is being moved (dragged). Can be used to adjust the items start, end, and/or group to allowed regions.</li>
  1382. <li><code>onRemove(item, callback)</code> Fired when an item is about to be deleted. If not implemented, the item will be always removed.</li>
  1383. </ul>
  1384. <p>
  1385. Each of the callbacks is invoked with two arguments:
  1386. </p>
  1387. <ul>
  1388. <li><code>item</code>: the item being manipulated</li>
  1389. <li><code>callback</code>: a callback function which must be invoked to report back. The callback must be invoked as <code>callback(item or null)</code>. Here, <code>item</code> can contain changes to the passed item. Parameter `item` typically contains fields `content`, `start`, and optionally `end`. The type of `start` and `end` is determined by the DataSet type configuration and is `Date` by default. When invoked as <code>callback(null)</code>, the action will be cancelled.</li>
  1390. </ul>
  1391. <p>
  1392. Example code:
  1393. </p>
  1394. <pre class="prettyprint lang-js">var options = {
  1395. onUpdate: function (item, callback) {
  1396. item.content = prompt('Edit items text:', item.content);
  1397. if (item.content != null) {
  1398. callback(item); // send back adjusted item
  1399. }
  1400. else {
  1401. callback(null); // cancel updating the item
  1402. }
  1403. }
  1404. };
  1405. </pre>
  1406. A full example is available here: <a href="../../examples/timeline/editing/editingItemsCallbacks.html">editingItemsCallbacks.html</a>.
  1407. <h2 id="Templates">Templates</h2>
  1408. <p>
  1409. Timeline supports templates to format item contents. Any template engine (such as <a href="http://handlebarsjs.com/">handlebars</a> or <a href="http://mustache.github.io/">mustache</a>) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an items data as argument, and outputs formatted HTML:
  1410. </p>
  1411. <pre class="prettyprint lang-js">var options = {
  1412. template: function (item) {
  1413. var html = ... // generate HTML markup for this item
  1414. return html;
  1415. }
  1416. };
  1417. </pre>
  1418. <h3>Create HTML manually</h3>
  1419. The HTML for an item can be created manually:
  1420. <pre class="prettyprint lang-js">var options = {
  1421. template: function (item) {
  1422. return '&lt;h1&gt;' + item.header + '&lt;/h1&gt;&lt;p&gt;' + item.description + '&lt;/p&gt;';
  1423. }
  1424. };
  1425. </pre>
  1426. <h3>Using a template engine</h3>
  1427. Using <a href="http://handlebarsjs.com/">handlebars</a>, one can write the template in HTML:
  1428. <pre class="prettyprint lang-html">
  1429. &lt;script id="item-template" type="text/x-handlebars-template"&gt;
  1430. &lt;h1&gt;{{header}}&lt;/h1&gt;
  1431. &lt;p&gt;{{description}}&lt;/p&gt;
  1432. &lt;/script&gt;
  1433. </pre>
  1434. Compile the template:
  1435. <pre class="prettyprint lang-js">
  1436. var source = document.getElementById('item-template').innerHTML;
  1437. var template = Handlebars.compile(source);
  1438. </pre>
  1439. And then specify the template in the Timeline options
  1440. <pre class="prettyprint lang-js">var options = {
  1441. template: template
  1442. };
  1443. </pre>
  1444. <h3>Multiple templates</h3>
  1445. In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property:
  1446. <pre class="prettyprint lang-js">
  1447. var templates = {
  1448. template1: Handlebars.compile(...),
  1449. template2: Handlebars.compile(...),
  1450. template2: Handlebars.compile(...),
  1451. ...
  1452. };
  1453. var options = {
  1454. template: function (item) {
  1455. var template = templates[item.template]; // choose the right template
  1456. return template(item); // execute the template
  1457. }
  1458. };
  1459. </pre>
  1460. Now the items can be extended with a property <code>template</code>, specifying which template to use for the item.
  1461. <h2 id="Localization">Localization</h2>
  1462. <p>
  1463. Timeline can be localized. For localization, Timeline depends largely on the localization of <a href="http://momentjs.com">moment.js</a>. Locales are not included in vis.js by default. To enable localization, moment.js must be loaded with locales. Moment.js offers a bundle named "moment-with-locales.min.js" for this and there are various alternative ways to load locales.
  1464. </p>
  1465. <p>
  1466. To set a locale for the Timeline, specify the option <code>locale</code>:
  1467. </p>
  1468. <pre class="prettyprint lang-js">var options = {
  1469. locale: 'nl'
  1470. };
  1471. </pre>
  1472. <h3>Create a new locale</h3>
  1473. To load a locale into the Timeline not supported by default, one can add a new locale to the option <code>locales</code>:
  1474. <pre class="prettyprint lang-js">var options = {
  1475. locales: {
  1476. // create a new locale (text strings should be replaced with localized strings)
  1477. mylocale: {
  1478. current: 'current',
  1479. time: 'time',
  1480. }
  1481. },
  1482. // use the new locale
  1483. locale: 'mylocale'
  1484. };
  1485. </pre>
  1486. <h3 id="available-locales">Available locales</h3>
  1487. <p>
  1488. Timeline comes with support for the following locales:
  1489. </p>
  1490. <table>
  1491. <tr>
  1492. <th>Language</th>
  1493. <th>Code</th>
  1494. </tr>
  1495. <tr>
  1496. <td>English</td>
  1497. <td>
  1498. <code>en</code><br>
  1499. <code>en_EN</code><br>
  1500. <code>en_US</code>
  1501. </td>
  1502. </tr>
  1503. <tr>
  1504. <td>Dutch</td>
  1505. <td>
  1506. <code>nl</code><br>
  1507. <code>nl_NL</code><br>
  1508. <code>nl_BE</code>
  1509. </td>
  1510. </tr>
  1511. </table>
  1512. <h2 id="Time_zone">Time zone</h2>
  1513. <p>
  1514. By default, the Timeline displays time in local time. To display a Timeline in an other time zone or in UTC, the date constructor can be overloaded via the configuration option <code>moment</code>, which by default is the constructor function of moment.js. More information about UTC with moment.js can be found in the docs: <a href="http://momentjs.com/docs/#/parsing/utc/">http://momentjs.com/docs/#/parsing/utc/</a>.
  1515. </p>
  1516. <p>
  1517. Examples:
  1518. </p>
  1519. <pre class="prettyprint lang-js">// display in UTC
  1520. var options = {
  1521. moment: function(date) {
  1522. return vis.moment(date).utc();
  1523. }
  1524. };
  1525. // display in UTC +08:00
  1526. var options = {
  1527. moment: function(date) {
  1528. return vis.moment(date).utcOffset('+08:00');
  1529. }
  1530. };
  1531. </pre>
  1532. <h2 id="Styles">Styles</h2>
  1533. <p>
  1534. All parts of the Timeline have a class name and a default css style.
  1535. The styles can be overwritten, which enables full customization of the layout
  1536. of the Timeline.
  1537. </p>
  1538. <p>For example, to change the border and background color of all items, include the
  1539. following code inside the head of your html code or in a separate stylesheet.</p>
  1540. <pre class="prettyprint lang-html">&lt;style&gt;
  1541. .vis-item {
  1542. border-color: orange;
  1543. background-color: yellow;
  1544. }
  1545. &lt;/style&gt;
  1546. </pre>
  1547. <h3 id="Grid_Backgrounds">Grid Backgrounds</h3>
  1548. <p>
  1549. The background grid of the time axis can be styled, for example to highlight
  1550. weekends or to create grids with an alternating white/lightgray background.
  1551. </p>
  1552. <p>
  1553. Depending on the zoom level, the grids get certain css classes attached.
  1554. The following classes are available:
  1555. </p>
  1556. <table class="styles">
  1557. <tr>
  1558. <th>Description</th><th>Values</th>
  1559. </tr>
  1560. <tr>
  1561. <td>Alternating columns</td><td><code>vis-even</code>, <code>vis-odd</code></td>
  1562. </tr>
  1563. <tr>
  1564. <td>Current date</td><td><code>vis-today</code>, <code>vis-tomorrow</code>, <code>vis-yesterday</code>, <code>vis-current-week</code>, <code>vis-current-month</code>, <code>vis-current-year</code></td>
  1565. </tr>
  1566. <tr>
  1567. <td>Hours</td><td><code>vis-h0</code>, <code>vis-h1</code>, ..., <code>vis-h23</code></td>
  1568. </tr>
  1569. <tr>
  1570. <td>Grouped hours</td><td><code>vis-h0-h4</code> to <code>vis-h20-h24</code></td>
  1571. </tr>
  1572. <tr>
  1573. <td>Weekday</td><td><code>vis-monday</code>, <code>vis-tuesday</code>, <code>vis-wednesday</code>, <code>vis-thursday</code>, <code>vis-friday</code>, <code>vis-saturday</code>, <code>vis-sunday</code></td>
  1574. </tr>
  1575. <tr>
  1576. <td>Days</td><td><code>vis-date1</code>, <code>vis-date2</code>, ..., <code>vis-date31</code></td>
  1577. </tr>
  1578. <tr>
  1579. <td>Months</td><td><code>vis-januari</code>, <code>vis-februari</code>, <code>vis-march</code>, <code>vis-april</code>, <code>vis-may</code>, <code>vis-june</code>, <code>vis-july</code>, <code>vis-august</code>, <code>vis-september</code>, <code>vis-october</code>, <code>vis-november</code>, <code>vis-december</code></td>
  1580. </tr>
  1581. <tr>
  1582. <td>Years</td><td><code>vis-year2014</code>, <code>vis-year2015</code>, ...</td>
  1583. </tr>
  1584. </table>
  1585. <p>Examples:</p>
  1586. <pre class="prettyprint lang-html">&lt;style&gt;
  1587. /* alternating column backgrounds */
  1588. .vis-time-axis .grid.vis-odd {
  1589. background: #f5f5f5;
  1590. }
  1591. /* gray background in weekends, white text color */
  1592. .vis-time-axis .vis-grid.vis-saturday,
  1593. .vis-time-axis .vis-grid.vis-sunday {
  1594. background: gray;
  1595. }
  1596. .vis-time-axis .vis-text.vis-saturday,
  1597. .vis-time-axis .vis-text.vis-sunday {
  1598. color: white;
  1599. }
  1600. &lt;/style&gt;
  1601. </pre>
  1602. </div>
  1603. <!-- Bootstrap core JavaScript
  1604. ================================================== -->
  1605. <!-- Placed at the end of the document so the pages load faster -->
  1606. <script src="../js/jquery.min.js"></script>
  1607. <script src="../js/bootstrap.min.js"></script>
  1608. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  1609. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  1610. <!-- jquery extensions -->
  1611. <script src="../js/jquery.highlight.js"></script>
  1612. <script src="../js/jquery.url.min.js"></script>
  1613. <!-- Tipue vendor js -->
  1614. <script src="../js/tipuesearch.config.js"></script>
  1615. <script src="../js/tipuesearch.js"></script>
  1616. <!-- controller -->
  1617. <script src="../js/main.js"></script>