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.

1400 lines
44 KiB

9 years ago
9 years ago
9 years ago
9 years ago
  1. <html>
  2. <head>
  3. <title>vis.js | timeline documentation</title>
  4. <link href='css/prettify.css' type='text/css' rel='stylesheet'>
  5. <link href='css/style.css' type='text/css' rel='stylesheet'>
  6. <script type="text/javascript" src="lib/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <div id="container">
  10. <h1>Timeline documentation</h1>
  11. <h2 id="Overview">Overview</h2>
  12. <p>
  13. The Timeline is an interactive visualization chart to visualize data in time.
  14. The data items can take place on a single date, or have a start and end date (a range).
  15. You can freely move and zoom in the timeline by dragging and scrolling in the
  16. Timeline. Items can be created, edited, and deleted in the timeline.
  17. The time scale on the axis is adjusted automatically, and supports scales ranging
  18. from milliseconds to years.
  19. </p>
  20. <p>
  21. Timeline uses regular HTML DOM to render the timeline and items put on the
  22. timeline. This allows for flexible customization using css styling.
  23. </p>
  24. <h2 id="Contents">Contents</h2>
  25. <ul>
  26. <li><a href="#Overview">Overview</a></li>
  27. <li><a href="#Example">Example</a></li>
  28. <li><a href="#Loading">Loading</a></li>
  29. <li><a href="#Data_Format">Data Format</a>
  30. <ul>
  31. <li><a href="#items">Items</a></li>
  32. <li><a href="#groups">Groups</a></li>
  33. </ul>
  34. </li>
  35. <li><a href="#Configuration_Options">Configuration Options</a></li>
  36. <li><a href="#Methods">Methods</a></li>
  37. <li><a href="#Events">Events</a></li>
  38. <li><a href="#Editing_Items">Editing Items</a></li>
  39. <li><a href="#Templates">Templates</a></li>
  40. <li><a href="#Localization">Localization</a></li>
  41. <li><a href="#Styles">Styles</a></li>
  42. <li><a href="#Data_Policy">Data Policy</a></li>
  43. </ul>
  44. <h2 id="Example">Example</h2>
  45. <p>
  46. The following code shows how to create a Timeline and provide it with data.
  47. More examples can be found in the <a href="../examples">examples</a> directory.
  48. </p>
  49. <pre class="prettyprint lang-html">&lt;!DOCTYPE HTML&gt;
  50. &lt;html&gt;
  51. &lt;head&gt;
  52. &lt;title&gt;Timeline | Basic demo&lt;/title&gt;
  53. &lt;style type="text/css"&gt;
  54. body, html {
  55. font-family: sans-serif;
  56. }
  57. &lt;/style&gt;
  58. &lt;script src="../../dist/vis.js"&gt;&lt;/script&gt;
  59. &lt;link href="../../dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  60. &lt;/head&gt;
  61. &lt;body&gt;
  62. &lt;div id="visualization"&gt;&lt;/div&gt;
  63. &lt;script type="text/javascript"&gt;
  64. // DOM element where the Timeline will be attached
  65. var container = document.getElementById('visualization');
  66. // Create a DataSet (allows two way data-binding)
  67. var items = new vis.DataSet([
  68. {id: 1, content: 'item 1', start: '2013-04-20'},
  69. {id: 2, content: 'item 2', start: '2013-04-14'},
  70. {id: 3, content: 'item 3', start: '2013-04-18'},
  71. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  72. {id: 5, content: 'item 5', start: '2013-04-25'},
  73. {id: 6, content: 'item 6', start: '2013-04-27'}
  74. ]);
  75. // Configuration for the Timeline
  76. var options = {};
  77. // Create a Timeline
  78. var timeline = new vis.Timeline(container, items, options);
  79. &lt;/script&gt;
  80. &lt;/body&gt;
  81. &lt;/html&gt;
  82. </pre>
  83. <h2 id="Loading">Loading</h2>
  84. <p>
  85. Install or download the <a href="http://visjs.org" target="_blank">vis.js</a> library.
  86. in a subfolder of your project. Include the libraries script and css files in the
  87. head of your html code:
  88. </p>
  89. <pre class="prettyprint lang-html">
  90. &lt;script src="vis/dist/vis.js"&gt;&lt;/script&gt;
  91. &lt;link href="vis/dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  92. </pre>
  93. The constructor of the Timeline is <code>vis.Timeline</code>
  94. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, options);</pre>
  95. or when using groups:
  96. <pre class="prettyprint lang-js">var timeline = new vis.Timeline(container, items, groups, options);</pre>
  97. The constructor accepts four parameters:
  98. <ul>
  99. <li>
  100. <code>container</code> is the DOM element in which to create the timeline.
  101. </li>
  102. <li>
  103. <code>items</code> is an Array containing items. The properties of an
  104. item are described in section <a href="#Data_Format">Data Format, items</a>.
  105. </li><li>
  106. <code>groups</code> is an Array containing groups. The properties of a
  107. group are described in section <a href="#groups">Data Format, groups</a>.
  108. </li>
  109. <li>
  110. <code>options</code> is an optional Object containing a name-value map
  111. with options. Options can also be set using the method
  112. <code>setOptions</code>.
  113. </li>
  114. </ul>
  115. <h2 id="Data_Format">Data Format</h2>
  116. <p>
  117. The timeline can be provided with two types of data:
  118. </p>
  119. <ul>
  120. <li><a href="#items">Items</a> containing a set of items to be displayed in time.</li>
  121. <li><a href="#groups">Groups</a> containing a set of groups used to group items
  122. together.</li>
  123. </ul>
  124. <h3 id="items">Items</h3>
  125. <p>
  126. The Timeline uses regular Arrays and Objects as data format.
  127. Data items can contain the properties <code>start</code>,
  128. <code>end</code> (optional), <code>content</code>,
  129. <code>group</code> (optional), <code>className</code> (optional),
  130. and <code>style</code> (optional).
  131. </p>
  132. <p>
  133. A table is constructed as:
  134. </p>
  135. <pre class="prettyprint lang-js">
  136. var items = [
  137. {
  138. start: new Date(2010, 7, 15),
  139. end: new Date(2010, 8, 2), // end is optional
  140. content: 'Trajectory A'
  141. // Optional: fields 'id', 'type', 'group', 'className', 'style'
  142. }
  143. // more items...
  144. ]);
  145. </pre>
  146. <p>
  147. The item properties are defined as:
  148. </p>
  149. <table>
  150. <tr>
  151. <th>Name</th>
  152. <th>Type</th>
  153. <th>Required</th>
  154. <th>Description</th>
  155. </tr>
  156. <tr>
  157. <td>className</td>
  158. <td>String</td>
  159. <td>no</td>
  160. <td>This field is optional. A className can be used to give items
  161. an individual css style. For example, when an item has className
  162. 'red', one can define a css style like:
  163. <pre class="prettyprint lang-css">
  164. .vis.timeline .red {
  165. color: white;
  166. background-color: red;
  167. border-color: darkred;
  168. }</pre>
  169. More details on how to style items can be found in the section
  170. <a href="#Styles">Styles</a>.
  171. </td>
  172. </tr>
  173. <tr>
  174. <td>content</td>
  175. <td>String</td>
  176. <td>yes</td>
  177. <td>The contents of the item. This can be plain text or html code.</td>
  178. </tr>
  179. <tr>
  180. <td>end</td>
  181. <td>Date</td>
  182. <td>no</td>
  183. <td>The end date of the item. The end date is optional, and can be left <code>null</code>.
  184. If end date is provided, the item is displayed as a range.
  185. If not, the item is displayed as a box.</td>
  186. </tr>
  187. <tr>
  188. <td>group</td>
  189. <td>any type</td>
  190. <td>no</td>
  191. <td>This field is optional. When the group column is provided,
  192. all items with the same group are placed on one line.
  193. A vertical axis is displayed showing the groups.
  194. Grouping items can be useful for example when showing availability of multiple
  195. people, rooms, or other resources next to each other.<br>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td>id</td>
  200. <td>String | Number</td>
  201. <td>no</td>
  202. <td>An id for the item. Using an id is not required but highly
  203. recommended. An id is needed when dynamically adding, updating,
  204. and removing items in a DataSet.</td>
  205. </tr>
  206. <tr>
  207. <td>start</td>
  208. <td>Date</td>
  209. <td>yes</td>
  210. <td>The start date of the item, for example <code>new Date(2010,9,23)</code>.</td>
  211. </tr>
  212. <tr>
  213. <td>style</td>
  214. <td>String</td>
  215. <td>no</td>
  216. <td>
  217. A css text string to apply custom styling for an individual item, for
  218. example <code>"color: red; background-color: pink;"</code>.
  219. </td>
  220. </tr>
  221. <tr>
  222. <td>subgroup</td>
  223. <td>String | Number</td>
  224. <td>none</td>
  225. <td>The id of a subgroup.
  226. Groups all items within a group per subgroup, and positions them on the
  227. same height instead of staking them on top of each other. can be ordered
  228. by specifying the option <code>subgroupOrder</code> of a group.
  229. </td>
  230. </tr>
  231. <tr>
  232. <td>title</td>
  233. <td>String</td>
  234. <td>none</td>
  235. <td>Add a title for the item, displayed when holding the mouse on the item.
  236. The title can only contain plain text.
  237. </td>
  238. </tr>
  239. <tr>
  240. <td>type</td>
  241. <td>String</td>
  242. <td>'box'</td>
  243. <td>The type of the item. Can be 'box' (default), 'point', 'range', or 'background'.
  244. Types 'box' and 'point' need a start date, the types 'range' and 'background' needs both a start and end date.
  245. </td>
  246. </tr>
  247. </table>
  248. <h3 id="groups">Groups</h3>
  249. <p>
  250. Like the items, groups are regular JavaScript Arrays and Objects.
  251. Using groups, items can be grouped together.
  252. Items are filtered per group, and displayed as
  253. Group items can contain the properties <code>id</code>,
  254. <code>content</code>, and <code>className</code> (optional).
  255. </p>
  256. <p>
  257. Groups can be applied to a timeline using the method <code>setGroups</code> or supplied in the constructor.
  258. A table with groups can be created like:
  259. </p>
  260. <pre class="prettyprint lang-js">
  261. var groups = [
  262. {
  263. id: 1,
  264. content: 'Group 1'
  265. // Optional: a field 'className', 'style'
  266. }
  267. // more groups...
  268. ]);
  269. </pre>
  270. <p>
  271. Groups can have the following properties:
  272. </p>
  273. <table>
  274. <tr>
  275. <th>Name</th>
  276. <th>Type</th>
  277. <th>Required</th>
  278. <th>Description</th>
  279. </tr>
  280. <tr>
  281. <td>className</td>
  282. <td>String</td>
  283. <td>no</td>
  284. <td>This field is optional. A className can be used to give groups
  285. an individual css style. For example, when a group has className
  286. 'red', one can define a css style
  287. <code>
  288. .red {
  289. color: red;
  290. }
  291. </code>.
  292. More details on how to style groups can be found in the section
  293. <a href="#Styles">Styles</a>.
  294. </td>
  295. </tr>
  296. <tr>
  297. <td>content</td>
  298. <td>String</td>
  299. <td>yes</td>
  300. <td>The contents of the group. This can be plain text or html code.</td>
  301. </tr>
  302. <tr>
  303. <td>id</td>
  304. <td>String | Number</td>
  305. <td>yes</td>
  306. <td>An id for the group. The group will display all items having a
  307. property <code>group</code> which matches the <code>id</code>
  308. of the group.</td>
  309. </tr>
  310. <tr>
  311. <td>style</td>
  312. <td>String</td>
  313. <td>no</td>
  314. <td>
  315. A css text string to apply custom styling for an individual group label, for
  316. example <code>"color: red; background-color: pink;"</code>.
  317. </td>
  318. </tr>
  319. <tr>
  320. <td>subgroupOrder</td>
  321. <td>String | Function</td>
  322. <td>none</td>
  323. <td>Order the subgroups by a field name or custom sort function.
  324. By default, groups are ordered by first-come, first-show.
  325. </td>
  326. </tr>
  327. <tr>
  328. <td>title</td>
  329. <td>String</td>
  330. <td>none</td>
  331. <td>A title for the group, displayed when holding the mouse on the groups label.
  332. The title can only contain plain text.
  333. </td>
  334. </tr>
  335. </table>
  336. <h2 id="Configuration_Options">Configuration Options</h2>
  337. <p>
  338. Options can be used to customize the timeline.
  339. Options are defined as a JSON object. All options are optional.
  340. </p>
  341. <pre class="prettyprint lang-js">
  342. var options = {
  343. width: '100%',
  344. height: '30px',
  345. margin: {
  346. item: 20
  347. }
  348. };
  349. </pre>
  350. <p>
  351. The following options are available.
  352. </p>
  353. <table>
  354. <tr>
  355. <th>Name</th>
  356. <th>Type</th>
  357. <th>Default</th>
  358. <th>Description</th>
  359. </tr>
  360. <tr>
  361. <td>align</td>
  362. <td>String</td>
  363. <td>"center"</td>
  364. <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>
  365. </tr>
  366. <tr>
  367. <td>autoResize</td>
  368. <td>boolean</td>
  369. <td>true</td>
  370. <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>
  371. </tr>
  372. <tr>
  373. <td>clickToUse</td>
  374. <td>boolean</td>
  375. <td>false</td>
  376. <td>When a Timeline is configured to be <code>clickToUse</code>, it will react to mouse and touch events only when active.
  377. 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>
  378. </tr>
  379. <tr>
  380. <td>dataAttributes</td>
  381. <td>Array[String] | 'all'</td>
  382. <td>false</td>
  383. <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>
  384. If value is <code>'all'</code> then each field defined on the timeline item will become a <code>data-</code> attribute.</td>
  385. </tr>
  386. <tr>
  387. <td>editable</td>
  388. <td>Boolean | Object</td>
  389. <td>false</td>
  390. <td>If true, the items in the timeline can be manipulated. Only applicable when option <code>selectable</code> is <code>true</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.
  391. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.
  392. </td>
  393. </tr>
  394. <tr>
  395. <td>editable.add</td>
  396. <td>Boolean</td>
  397. <td>false</td>
  398. <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>
  399. </tr>
  400. <tr>
  401. <td>editable.remove</td>
  402. <td>Boolean</td>
  403. <td>false</td>
  404. <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>
  405. </tr>
  406. <tr>
  407. <td>editable.updateGroup</td>
  408. <td>Boolean</td>
  409. <td>false</td>
  410. <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>
  411. </tr>
  412. <tr>
  413. <td>editable.updateTime</td>
  414. <td>Boolean</td>
  415. <td>false</td>
  416. <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>
  417. </tr>
  418. <tr>
  419. <td>end</td>
  420. <td>Date | Number | String</td>
  421. <td>none</td>
  422. <td>The initial end date for the axis of the timeline.
  423. If not provided, the latest date present in the items set is taken as
  424. end date.</td>
  425. </tr>
  426. <tr>
  427. <td>format</td>
  428. <td>Object</td>
  429. <td>none</td>
  430. <td>
  431. Apply custom date formatting of the labels on the time axis. The default value of <code>format</code> is:
  432. <pre class="prettyprint lang-js">{
  433. minorLabels: {
  434. millisecond:'SSS',
  435. second: 's',
  436. minute: 'HH:mm',
  437. hour: 'HH:mm',
  438. weekday: 'ddd D',
  439. day: 'D',
  440. month: 'MMM',
  441. year: 'YYYY'
  442. },
  443. majorLabels: {
  444. millisecond:'HH:mm:ss',
  445. second: 'D MMMM HH:mm',
  446. minute: 'ddd D MMMM',
  447. hour: 'ddd D MMMM',
  448. weekday: 'MMMM YYYY',
  449. day: 'MMMM YYYY',
  450. month: 'YYYY',
  451. year: ''
  452. }
  453. }</pre>
  454. For values which not provided in the customized <code>options.format</code>, the default values will be used.
  455. All available formatting syntax is described in the <a href="http://momentjs.com/docs/#/displaying/format/">docs of moment.js</a>.
  456. </td>
  457. </tr>
  458. <tr>
  459. <td>groupOrder</td>
  460. <td>String | Function</td>
  461. <td>none</td>
  462. <td>Order the groups by a field name or custom sort function.
  463. By default, groups are not ordered.
  464. </td>
  465. </tr>
  466. <tr>
  467. <td>height</td>
  468. <td>Number | String</td>
  469. <td>none</td>
  470. <td>The height of the timeline in pixels or as a percentage.
  471. When height is undefined or null, the height of the timeline is automatically
  472. adjusted to fit the contents.
  473. It is possible to set a maximum height using option <code>maxHeight</code>
  474. to prevent the timeline from getting too high in case of automatically
  475. calculated height.
  476. </td>
  477. </tr>
  478. <tr>
  479. <td>hiddenDates</td>
  480. <td>Object</td>
  481. <td>none</td>
  482. <td>This option allows you to hide specific timespans from the time axis. The dates can be supplied as an object:
  483. <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.
  484. 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
  485. and set repeat to weekly.
  486. </td>
  487. </tr>
  488. <tr>
  489. <td>locale</td>
  490. <td>String</td>
  491. <td>none</td>
  492. <td>Select a locale for the Timeline. See section <a href="#Localization">Localization</a> for more information.</td>
  493. </tr>
  494. <tr>
  495. <td>locales</td>
  496. <td>Object</td>
  497. <td>none</td>
  498. <td>A map with i18n locales. See section <a href="#Localization">Localization</a> for more information.</td>
  499. </tr>
  500. <tr>
  501. <td>margin.axis</td>
  502. <td>Number</td>
  503. <td>20</td>
  504. <td>The minimal margin in pixels between items and the time axis.</td>
  505. </tr>
  506. <tr>
  507. <td>margin.item</td>
  508. <td>Number</td>
  509. <td>10</td>
  510. <td>The minimal margin in pixels between items in both horizontal and vertical direction.</td>
  511. </tr>
  512. <tr>
  513. <td>margin.item.horizontal</td>
  514. <td>Number</td>
  515. <td>10</td>
  516. <td>The minimal horizontal margin in pixels between items.</td>
  517. </tr>
  518. <tr>
  519. <td>margin.item.vertical</td>
  520. <td>Number</td>
  521. <td>10</td>
  522. <td>The minimal vertical margin in pixels between items.</td>
  523. </tr>
  524. <tr>
  525. <td>max</td>
  526. <td>Date | Number | String</td>
  527. <td>none</td>
  528. <td>Set a maximum Date for the visible range.
  529. It will not be possible to move beyond this maximum.
  530. </td>
  531. </tr>
  532. <tr>
  533. <td>maxHeight</td>
  534. <td>Number | String</td>
  535. <td>none</td>
  536. <td>Specifies the maximum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  537. </tr>
  538. <tr>
  539. <td>min</td>
  540. <td>Date | Number | String</td>
  541. <td>none</td>
  542. <td>Set a minimum Date for the visible range.
  543. It will not be possible to move beyond this minimum.
  544. </td>
  545. </tr>
  546. <tr>
  547. <td>minHeight</td>
  548. <td>Number | String</td>
  549. <td>none</td>
  550. <td>Specifies the minimum height for the Timeline. Can be a number in pixels or a string like "300px".</td>
  551. </tr>
  552. <tr>
  553. <td>moveable</td>
  554. <td>Boolean</td>
  555. <td>true</td>
  556. <td>
  557. Specifies whether the Timeline can be moved and zoomed by dragging the window.
  558. See also option <code>zoomable</code>.
  559. </td>
  560. </tr>
  561. <tr>
  562. <td>onAdd</td>
  563. <td>Function</td>
  564. <td>none</td>
  565. <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>true</code>.
  566. </td>
  567. </tr>
  568. <tr>
  569. <td>onUpdate</td>
  570. <td>Function</td>
  571. <td>none</td>
  572. <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>true</code>.
  573. </td>
  574. </tr>
  575. <tr>
  576. <td>onMove</td>
  577. <td>Function</td>
  578. <td>none</td>
  579. <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>true</code>.
  580. </td>
  581. </tr>
  582. <tr>
  583. <td>onMoving</td>
  584. <td>Function</td>
  585. <td>none</td>
  586. <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>true</code>.
  587. </td>
  588. </tr>
  589. <tr>
  590. <td>onRemove</td>
  591. <td>Function</td>
  592. <td>none</td>
  593. <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>true</code>.
  594. </td>
  595. </tr>
  596. <!-- TODO: cleanup option order
  597. <tr>
  598. <td>order</td>
  599. <td>Function</td>
  600. <td>none</td>
  601. <td>Provide a custom sort function to order the items. The order of the
  602. items is determining the way they are stacked. The function
  603. order is called with two parameters, both of type
  604. `vis.components.items.Item`.
  605. </td>
  606. </tr>
  607. -->
  608. <tr>
  609. <td>orientation</td>
  610. <td>String</td>
  611. <td>'bottom'</td>
  612. <td>Orientation of the timeline: 'top' or 'bottom' (default). If orientation is 'bottom', the time axis is drawn at the bottom, and if 'top', the axis is drawn on top.</td>
  613. </tr>
  614. <tr>
  615. <td>padding</td>
  616. <td>Number</td>
  617. <td>5</td>
  618. <td>The padding of items, needed to correctly calculate the size
  619. of item ranges. Must correspond with the css of items, for example when setting <code>options.padding=10</code>, corresponding css is:
  620. <pre class="prettyprint lang-css">
  621. .vis.timeline .item {
  622. padding: 10px;
  623. }</pre>
  624. </td>
  625. </tr>
  626. <tr>
  627. <td>selectable</td>
  628. <td>Boolean</td>
  629. <td>true</td>
  630. <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>
  631. </tr>
  632. <tr>
  633. <td>showCurrentTime</td>
  634. <td>boolean</td>
  635. <td>true</td>
  636. <td>Show a vertical bar at the current time.</td>
  637. </tr>
  638. <tr>
  639. <td>showCustomTime</td>
  640. <td>boolean</td>
  641. <td>false</td>
  642. <td>Show a vertical bar displaying a custom time. This line can be dragged by the user. The custom time can be utilized to show a state in the past or in the future. When the custom time bar is dragged by the user, the event <code>timechange</code> is fired repeatedly. After the bar is dragged, the event <code>timechanged</code> is fired once.</td>
  643. </tr>
  644. <tr>
  645. <tr>
  646. <td>showMajorLabels</td>
  647. <td>boolean</td>
  648. <td>true</td>
  649. <td>By default, the timeline shows both minor and major date labels on the
  650. time axis.
  651. For example the minor labels show minutes and the major labels show hours.
  652. When <code>showMajorLabels</code> is <code>false</code>, no major labels
  653. are shown.</td>
  654. </tr>
  655. <tr>
  656. <td>showMinorLabels</td>
  657. <td>boolean</td>
  658. <td>true</td>
  659. <td>By default, the timeline shows both minor and major date labels on the
  660. time axis.
  661. For example the minor labels show minutes and the major labels show hours.
  662. When <code>showMinorLabels</code> is <code>false</code>, no minor labels
  663. are shown. When both <code>showMajorLabels</code> and
  664. <code>showMinorLabels</code> are false, no horizontal axis will be
  665. visible.</td>
  666. </tr>
  667. <tr>
  668. <td>stack</td>
  669. <td>Boolean</td>
  670. <td>true</td>
  671. <td>If true (default), items will be stacked on top of each other such that they do not overlap.</td>
  672. </tr>
  673. <tr>
  674. <td>start</td>
  675. <td>Date | Number | String</td>
  676. <td>none</td>
  677. <td>The initial start date for the axis of the timeline.
  678. If not provided, the earliest date present in the events is taken as start date.</td>
  679. </tr>
  680. <tr>
  681. <td>template</td>
  682. <td>Function</td>
  683. <td>none</td>
  684. <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>
  685. </tr>
  686. <tr>
  687. <td>type</td>
  688. <td>String</td>
  689. <td>none</td>
  690. <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.
  691. </td>
  692. </tr>
  693. <tr>
  694. <td>width</td>
  695. <td>String</td>
  696. <td>'100%'</td>
  697. <td>The width of the timeline in pixels or as a percentage.</td>
  698. </tr>
  699. <tr>
  700. <td>zoomable</td>
  701. <td>Boolean</td>
  702. <td>true</td>
  703. <td>
  704. Specifies whether the Timeline can be zoomed by pinching or scrolling in the window.
  705. Only applicable when option <code>moveable</code> is set <code>true</code>.
  706. </td>
  707. </tr>
  708. <tr>
  709. <td>zoomMax</td>
  710. <td>Number</td>
  711. <td>315360000000000</td>
  712. <td>Set a maximum zoom interval for the visible range in milliseconds.
  713. It will not be possible to zoom out further than this maximum.
  714. Default value equals about 10000 years.
  715. </td>
  716. </tr>
  717. <tr>
  718. <td>zoomMin</td>
  719. <td>Number</td>
  720. <td>10</td>
  721. <td>Set a minimum zoom interval for the visible range in milliseconds.
  722. It will not be possible to zoom in further than this minimum.
  723. </td>
  724. </tr>
  725. </table>
  726. <h2 id="Methods">Methods</h2>
  727. <p>
  728. The Timeline supports the following methods.
  729. </p>
  730. <table>
  731. <tr>
  732. <th>Method</th>
  733. <th>Return Type</th>
  734. <th>Description</th>
  735. </tr>
  736. <tr>
  737. <td>clear([what])</td>
  738. <td>none</td>
  739. <td>
  740. Clear the Timeline. An object can be passed specifying which sections to clear: items, groups,
  741. and/or options. By Default, items, groups and options are cleared, i.e. <code>what = {items: true, groups: true, options: true}</code>. Example usage:
  742. <pre class="prettyprint lang-js">timeline.clear(); // clear items, groups, and options
  743. timeline.clear({options: true}); // clear options only
  744. </pre>
  745. </td>
  746. </tr>
  747. <tr>
  748. <td>destroy()</td>
  749. <td>none</td>
  750. <td>Destroy the Timeline. The timeline is removed from memory. all DOM elements and event listeners are cleaned up.
  751. </td>
  752. </tr>
  753. <tr>
  754. <td>fit([options])</td>
  755. <td>none</td>
  756. <td>Adjust the visible window such that it fits all items. See also function <code>focus(id)</code>.
  757. Available options:
  758. <ul>
  759. <li><code>animate: boolean | number</code><br>If true (default), the range is animated smoothly to the new window. If a number, the number is taken as duration for the animation. Default duration is 500 ms.</li>
  760. </ul>
  761. </td>
  762. </tr>
  763. <tr>
  764. <td>focus(id | ids [, options])</td>
  765. <td>none</td>
  766. <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:
  767. <ul>
  768. <li><code>animate: boolean | number</code><br>If true (default), the range is animated smoothly to the new window. If a number, the number is taken as duration for the animation. Default duration is 500 ms.</li>
  769. </ul>
  770. </td>
  771. </tr>
  772. <tr>
  773. <td>getCurrentTime()</td>
  774. <td>Date</td>
  775. <td>Get the current time. Only applicable when option <code>showCurrentTime</code> is true.
  776. </td>
  777. </tr>
  778. <tr>
  779. <td>getCustomTime()</td>
  780. <td>Date</td>
  781. <td>Retrieve the custom time. Only applicable when the option <code>showCustomTime</code> is true.
  782. </td>
  783. </tr>
  784. <tr>
  785. <td>getSelection()</td>
  786. <td>Number[]</td>
  787. <td>Get an array with the ids of the currently selected items.</td>
  788. </tr>
  789. <tr>
  790. <td>getVisibleItems()</td>
  791. <td>Number[]</td>
  792. <td>Get an array with the ids of the currently visible items.</td>
  793. </tr>
  794. <tr>
  795. <td>getWindow()</td>
  796. <td>Object</td>
  797. <td>Get the current visible window. Returns an object with properties <code>start: Date</code> and <code>end: Date</code>.</td>
  798. </tr>
  799. <tr>
  800. <td>moveTo(time [, options])</td>
  801. <td>none</td>
  802. <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:
  803. <ul>
  804. <li><code>animate: boolean | number</code><br>If true (default), the range is animated smoothly to the new window. If a number, the number is taken as duration for the animation. Default duration is 500 ms.</li>
  805. </ul>
  806. </td>
  807. </tr>
  808. <tr>
  809. <td>on(event, callback)</td>
  810. <td>none</td>
  811. <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>. 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>
  812. </tr>
  813. <tr>
  814. <td>off(event, callback)</td>
  815. <td>none</td>
  816. <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>
  817. </tr>
  818. <tr>
  819. <td>redraw()</td>
  820. <td>none</td>
  821. <td>Force a redraw of the Timeline. Can be useful to manually redraw when option autoResize=false.
  822. </td>
  823. </tr>
  824. <tr>
  825. <td>setCurrentTime(time)</td>
  826. <td>none</td>
  827. <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.
  828. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  829. Only applicable when option <code>showCurrentTime</code> is true.</td>
  830. </tr>
  831. <tr>
  832. <td>setCustomTime(time)</td>
  833. <td>none</td>
  834. <td>Adjust the custom time bar. Only applicable when the option <code>showCustomTime</code> is true. <code>time</code> can be a Date object, numeric timestamp, or ISO date string.
  835. </td>
  836. </tr>
  837. <tr>
  838. <td>setGroups(groups)</td>
  839. <td>none</td>
  840. <td>Set a data set with groups for the Timeline.
  841. <code>groups</code> can be an Array with Objects,
  842. a DataSet, or a DataView. For each of the groups, the items of the
  843. timeline are filtered on the property <code>group</code>, which
  844. must correspond with the id of the group.
  845. </td>
  846. </tr>
  847. <tr>
  848. <td>setItems(items)</td>
  849. <td>none</td>
  850. <td>Set a data set with items for the Timeline.
  851. <code>items</code> can be an Array with Objects,
  852. a DataSet, or a DataView.
  853. </td>
  854. </tr>
  855. <tr>
  856. <td>setOptions(options)</td>
  857. <td>none</td>
  858. <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.
  859. </td>
  860. </tr>
  861. <tr>
  862. <td>setSelection(id | ids [, options])</td>
  863. <td>none</td>
  864. <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:
  865. <ul>
  866. <li><code>focus: boolean</code><br>If true, focus will be set to the selected item(s)</li>
  867. <li><code>animate: boolean | number</code><br>If true (default), the range is animated smoothly to the new window. If a number, the number is taken as duration for the animation. Default duration is 500 ms. Only applicable when option focus is true.</li>
  868. </ul>
  869. </td>
  870. </tr>
  871. <tr>
  872. <td>setWindow(start, end [, options])</td>
  873. <td>none</td>
  874. <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:
  875. <ul>
  876. <li><code>animate: boolean | number</code><br>If true (default), the range is animated smoothly to the new window. If a number, the number is taken as duration for the animation. Default duration is 500 ms.</li>
  877. </ul>
  878. </td>
  879. </tr>
  880. </table>
  881. <h2 id="Events">Events</h2>
  882. <p>
  883. Timeline fires events when changing the visible window by dragging, when
  884. selecting items, and when dragging the custom time bar.
  885. </p>
  886. <p>
  887. Here an example on how to listen for a <code>select</code> event.
  888. </p>
  889. <pre class="prettyprint lang-js">
  890. timeline.on('select', function (properties) {
  891. alert('selected items: ' + properties.nodes);
  892. });
  893. </pre>
  894. <p>
  895. A listener can be removed via the function <code>off</code>:
  896. </p>
  897. <pre class="prettyprint lang-js">
  898. function onSelect (properties) {
  899. alert('selected items: ' + properties.nodes);
  900. }
  901. // add event listener
  902. timeline.on('select', onSelect);
  903. // do stuff...
  904. // remove event listener
  905. timeline.off('select', onSelect);
  906. </pre>
  907. <p>
  908. The following events are available.
  909. </p>
  910. <table>
  911. <colgroup>
  912. <col style="width: 20%;">
  913. <col style="width: 40%;">
  914. <col style="width: 40%;">
  915. </colgroup>
  916. <tr>
  917. <th>name</th>
  918. <th>Description</th>
  919. <th>Properties</th>
  920. </tr>
  921. <tr>
  922. <td>finishedRedraw</td>
  923. <td>Fired after a redraw is complete. When moving the timeline around, this could be fired frequently.
  924. </td>
  925. <td>
  926. none.
  927. </td>
  928. </tr>
  929. <tr>
  930. <td>rangechange</td>
  931. <td>Fired repeatedly when the timeline window is being changed.
  932. </td>
  933. <td>
  934. <ul>
  935. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  936. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  937. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  938. </ul>
  939. </td>
  940. </tr>
  941. <tr>
  942. <td>rangechanged</td>
  943. <td>Fired once after the timeline window has been changed.
  944. </td>
  945. <td>
  946. <ul>
  947. <li><code>start</code> (Number): timestamp of the current start of the window.</li>
  948. <li><code>end</code> (Number): timestamp of the current end of the window.</li>
  949. <li><code>byUser</code> (Boolean): change happened because of user drag/zoom.</li>
  950. </ul>
  951. </td>
  952. </tr>
  953. <tr>
  954. <td>select</td>
  955. <td>Fired after the user selects or deselects items by tapping or holding them.
  956. When a use taps an already selected item, the select event is fired again.
  957. Not fired when the method <code>setSelection</code>is executed.
  958. </td>
  959. <td>
  960. <ul>
  961. <li><code>items</code>: an array with the ids of the selected items</li>
  962. </ul>
  963. </td>
  964. </tr>
  965. <tr>
  966. <td>timechange</td>
  967. <td>Fired repeatedly when the user is dragging the custom time bar.
  968. Only available when the custom time bar is enabled.
  969. </td>
  970. <td>
  971. <ul>
  972. <li><code>time</code> (Date): the current time.</li>
  973. </ul>
  974. </td>
  975. </tr>
  976. <tr>
  977. <td>timechanged</td>
  978. <td>Fired once after the user has dragged the custom time bar.
  979. Only available when the custom time bar is enabled.
  980. </td>
  981. <td>
  982. <ul>
  983. <li><code>time</code> (Date): the current time.</li>
  984. </ul>
  985. </td>
  986. </tr>
  987. </table>
  988. <h2 id="Editing_Items">Editing Items</h2>
  989. <p>
  990. When the Timeline is configured to be editable (both options <code>selectable</code> and <code>editable</code> are <code>true</code>), the user can move items by dragging them, can create a new item by double tapping on an empty space, can update an item by double tapping it, and can delete a selected item by clicking the delete button on the top right.
  991. </p>
  992. <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>
  993. <pre class="prettyprint lang-js">// enable or disable all manipulation actions
  994. var options = {
  995. editable: true // true or false
  996. };
  997. // enable or disable individual manipulation actions
  998. var options = {
  999. editable: {
  1000. add: true, // add new items by double tapping
  1001. updateTime: true, // drag items horizontally
  1002. updateGroup: true, // drag items from one group to another
  1003. remove: true // delete an item by tapping the delete button top right
  1004. }
  1005. };</pre>
  1006. <p>
  1007. One can specify callback functions to validate changes made by the user. There are a number of callback functions for this purpose:
  1008. </p>
  1009. <ul>
  1010. <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>
  1011. <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>
  1012. <li><code>onMove(item, callback)</code> Fired when an item has been moved. If not implemented, the move action will be accepted.</li>
  1013. <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>
  1014. <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>
  1015. </ul>
  1016. <p>
  1017. Each of the callbacks is invoked with two arguments:
  1018. </p>
  1019. <ul>
  1020. <li><code>item</code>: the item being manipulated</li>
  1021. <li><code>callback</code>: a callback function which must be invoked to report back. The callback must be invoked as <code>callback(item | 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>
  1022. </ul>
  1023. <p>
  1024. Example code:
  1025. </p>
  1026. <pre class="prettyprint lang-js">var options = {
  1027. onUpdate: function (item, callback) {
  1028. item.content = prompt('Edit items text:', item.content);
  1029. if (item.content != null) {
  1030. callback(item); // send back adjusted item
  1031. }
  1032. else {
  1033. callback(null); // cancel updating the item
  1034. }
  1035. }
  1036. };
  1037. </pre>
  1038. A full example is available here: <a href="../examples/timeline/08_edit_items.html">08_edit_items.html</a>.
  1039. <h2 id="Templates">Templates</h2>
  1040. <p>
  1041. 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:
  1042. </p>
  1043. <pre class="prettyprint lang-js">var options = {
  1044. template: function (item) {
  1045. var html = ... // generate HTML markup for this item
  1046. return html;
  1047. }
  1048. };
  1049. </pre>
  1050. <h3>Create HTML manually</h3>
  1051. The HTML for an item can be created manually:
  1052. <pre class="prettyprint lang-js">var options = {
  1053. template: function (item) {
  1054. return '&lt;h1&gt;' + item.header + '&lt;/h1&gt;&lt;p&gt;' + item.description + '&lt;/p&gt;';
  1055. }
  1056. };
  1057. </pre>
  1058. <h3>Using a template engine</h3>
  1059. Using <a href="http://handlebarsjs.com/">handlebars</a>, one can write the template in HTML:
  1060. <pre class="prettyprint lang-html">
  1061. &lt;script id="item-template" type="text/x-handlebars-template"&gt;
  1062. &lt;h1&gt;{{header}}&lt;/h1&gt;
  1063. &lt;p&gt;{{description}}&lt;/p&gt;
  1064. &lt;/script&gt;
  1065. </pre>
  1066. Compile the template:
  1067. <pre class="prettyprint lang-js">
  1068. var source = document.getElementById('item-template').innerHTML;
  1069. var template = Handlebars.compile(source);
  1070. </pre>
  1071. And then specify the template in the Timeline options
  1072. <pre class="prettyprint lang-js">var options = {
  1073. template: template
  1074. };
  1075. </pre>
  1076. <h3>Multiple templates</h3>
  1077. In order to support multiple templates, the template handler can be extended to switch between different templates, depending on a specific item property:
  1078. <pre class="prettyprint lang-js">
  1079. var templates = {
  1080. template1: Handlebars.compile(...),
  1081. template2: Handlebars.compile(...),
  1082. template2: Handlebars.compile(...),
  1083. ...
  1084. };
  1085. var options = {
  1086. template: function (item) {
  1087. var template = templates[item.template]; // choose the right template
  1088. return template(item); // execute the template
  1089. }
  1090. };
  1091. </pre>
  1092. Now the items can be extended with a property <code>template</code>, specifying which template to use for the item.
  1093. <h2 id="Localization">Localization</h2>
  1094. <p>
  1095. 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.
  1096. </p>
  1097. <p>
  1098. To set a locale for the Timeline, specify the option <code>locale</code>:
  1099. </p>
  1100. <pre class="prettyprint lang-js">var options = {
  1101. locale: 'nl'
  1102. };
  1103. </pre>
  1104. <h3>Create a new locale</h3>
  1105. To load a locale into the Timeline not supported by default, one can add a new locale to the option <code>locales</code>:
  1106. <pre class="prettyprint lang-js">var options = {
  1107. locales: {
  1108. // create a new locale (text strings should be replaced with localized strings)
  1109. mylocale: {
  1110. current: 'current',
  1111. time: 'time',
  1112. }
  1113. },
  1114. // use the new locale
  1115. locale: 'mylocale'
  1116. };
  1117. </pre>
  1118. <h3 id="available-locales">Available locales</h3>
  1119. <p>
  1120. Timeline comes with support for the following locales:
  1121. </p>
  1122. <table>
  1123. <tr><th>Language</th><th>Code</th></tr>
  1124. <tr>
  1125. <td>English</td>
  1126. <td>
  1127. <code>en</code><br>
  1128. <code>en_EN</code><br>
  1129. <code>en_US</code>
  1130. </td>
  1131. </tr>
  1132. <tr>
  1133. <td>Dutch</td>
  1134. <td>
  1135. <code>nl</code><br>
  1136. <code>nl_NL</code><br>
  1137. <code>nl_BE</code>
  1138. </td>
  1139. </tr>
  1140. </table>
  1141. <h2 id="Styles">Styles</h2>
  1142. <p>
  1143. All parts of the Timeline have a class name and a default css style.
  1144. The styles can be overwritten, which enables full customization of the layout
  1145. of the Timeline.
  1146. </p>
  1147. <p>For example, to change the border and background color of all items, include the
  1148. following code inside the head of your html code or in a separate stylesheet.</p>
  1149. <pre class="prettyprint lang-html">&lt;style&gt;
  1150. .vis.timeline .item {
  1151. border-color: orange;
  1152. background-color: yellow;
  1153. }
  1154. &lt;/style&gt;
  1155. </pre>
  1156. <h3 id="Grid_Backgrounds">Grid Backgrounds</h3>
  1157. <p>
  1158. The background grid of the time axis can be styled, for example to highlight
  1159. weekends or to create grids with an alternating white/lightgray background.
  1160. </p>
  1161. <p>
  1162. Depending on the zoom level, the grids get certain css classes attached.
  1163. The following classes are available:
  1164. </p>
  1165. <table>
  1166. <tr>
  1167. <th>Description</th><th>values</th>
  1168. </tr>
  1169. <tr>
  1170. <td>Alternating columns</td><td><code>even</code>, <code>odd</code></td>
  1171. </tr>
  1172. <tr>
  1173. <td>Current date</td><td><code>today</code>, <code>tomorrow</code>, <code>yesterday</code>, <code>current-week</code>, <code>current-month</code>, <code>current-year</code></td>
  1174. </tr>
  1175. <tr>
  1176. <td>Hours</td><td><code>0h</code>, <code>1h</code>, ..., <code>23h</code></td>
  1177. </tr>
  1178. <tr>
  1179. <td>Grouped hours</td><td><code>0-4h</code> to <code>20-24h</code></td>
  1180. </tr>
  1181. <tr>
  1182. <td>Weekday</td><td><code>monday</code>, <code>tuesday</code>, <code>wednesday</code>, <code>thursday</code>, <code>friday</code>, <code>saturday</code>, <code>sunday</code></td>
  1183. </tr>
  1184. <tr>
  1185. <td>Days</td><td><code>date1</code>, <code>date2</code>, ..., <code>date31</code></td>
  1186. </tr>
  1187. <tr>
  1188. <td>Months</td><td><code>januari</code>, <code>februari</code>, <code>march</code>, <code>april</code>, <code>may</code>, <code>june</code>, <code>july</code>, <code>august</code>, <code>september</code>, <code>october</code>, <code>november</code>, <code>december</code></td>
  1189. </tr>
  1190. <tr>
  1191. <td>Years</td><td><code>year2014</code>, <code>year2015</code>, ...</td>
  1192. </tr>
  1193. </table>
  1194. <p>Examples:</p>
  1195. <pre class="prettyprint lang-html">&lt;style&gt;
  1196. /* alternating column backgrounds */
  1197. .vis.timeline .timeaxis .grid.odd {
  1198. background: #f5f5f5;
  1199. }
  1200. /* gray background in weekends, white text color */
  1201. .vis.timeline .timeaxis .grid.saturday,
  1202. .vis.timeline .timeaxis .grid.sunday {
  1203. background: gray;
  1204. }
  1205. .vis.timeline .timeaxis .text.saturday,
  1206. .vis.timeline .timeaxis .text.sunday {
  1207. color: white;
  1208. }
  1209. &lt;/style&gt;
  1210. </pre>
  1211. <h2 id="Data_Policy">Data Policy</h2>
  1212. <p>
  1213. All code and data is processed and rendered in the browser.
  1214. No data is sent to any server.
  1215. </p>
  1216. </div>
  1217. </body>
  1218. </html>