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.

864 lines
22 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>vis.js | DataSet documentation</title>
  5. <link href="css/prettify.css" type="text/css" rel="stylesheet" />
  6. <link href='css/style.css' type='text/css' rel='stylesheet'>
  7. <script type="text/javascript" src="lib/prettify/prettify.js"></script>
  8. </head>
  9. <body onload="prettyPrint();">
  10. <div id="container">
  11. <h1>DataSet documentation</h1>
  12. <h2 id="Contents">Contents</h2>
  13. <ul>
  14. <li><a href="#Overview">Overview</a></li>
  15. <li><a href="#Example">Example</a></li>
  16. <li><a href="#Construction">Construction</a></li>
  17. <li><a href="#Methods">Methods</a></li>
  18. <li><a href="#Subscriptions">Subscriptions</a></li>
  19. <li><a href="#Data_Manipulation">Data Manipulation</a></li>
  20. <li><a href="#Data_Selection">Data Selection</a></li>
  21. <li><a href="#Data_Policy">Data Policy</a></li>
  22. </ul>
  23. <h2 id="Overview">Overview</h2>
  24. <p>
  25. Vis.js comes with a flexible DataSet, which can be used to hold and
  26. manipulate unstructured data and listen for changes in the data.
  27. The DataSet is key/value based. Data items can be added, updated and
  28. removed from the DatSet, and one can subscribe to changes in the DataSet.
  29. The data in the DataSet can be filtered and ordered, and fields (like
  30. dates) can be converted to a specific type. Data can be normalized when
  31. appending it to the DataSet as well.
  32. </p>
  33. <h2 id="Example">Example</h2>
  34. <p>
  35. The following example shows how to use a DataSet.
  36. </p>
  37. <pre class="prettyprint lang-js">
  38. // create a DataSet
  39. var options = {};
  40. var data = new vis.DataSet(options);
  41. // add items
  42. // note that the data items can contain different properties and data formats
  43. data.add([
  44. {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true},
  45. {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
  46. {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
  47. {id: 4, text: 'item 4'}
  48. ]);
  49. // subscribe to any change in the DataSet
  50. data.on('*', function (event, properties, senderId) {
  51. console.log('event', event, properties);
  52. });
  53. // update an existing item
  54. data.update({id: 2, group: 1});
  55. // remove an item
  56. data.remove(4);
  57. // get all ids
  58. var ids = data.getIds();
  59. console.log('ids', ids);
  60. // get a specific item
  61. var item1 = data.get(1);
  62. console.log('item1', item1);
  63. // retrieve a filtered subset of the data
  64. var items = data.get({
  65. filter: function (item) {
  66. return item.group == 1;
  67. }
  68. });
  69. console.log('filtered items', items);
  70. // retrieve formatted items
  71. var items = data.get({
  72. fields: ['id', 'date'],
  73. type: {
  74. date: 'ISODate'
  75. }
  76. });
  77. console.log('formatted items', items);
  78. </pre>
  79. <h2 id="Construction">Construction</h2>
  80. <p>
  81. A DataSet can be constructed as:
  82. </p>
  83. <pre class="prettyprint lang-js">
  84. var data = new vis.DataSet([data] [, options])
  85. </pre>
  86. <p>
  87. After construction, data can be added to the DataSet using the methods
  88. <code>add</code> and <code>update</code>, as described in section
  89. <a href="#Data_Manipulation">Data Manipulation</a>.
  90. </p>
  91. <p>
  92. The parameter <code>data</code>code> is optional and can be an Array or
  93. Google DataTable with items.
  94. </p>
  95. <p>
  96. The parameter <code>options</code> is optional and is an object which can
  97. contain the following properties:
  98. </p>
  99. <table>
  100. <tr>
  101. <th>Name</th>
  102. <th>Type</th>
  103. <th>Default value</th>
  104. <th>Description</th>
  105. </tr>
  106. <tr>
  107. <td>fieldId</td>
  108. <td>String</td>
  109. <td>"id"</td>
  110. <td>
  111. The name of the field containing the id of the items.
  112. When data is fetched from a server which uses some specific
  113. field to identify items, this field name can be specified
  114. in the DataSet using the option <code>fieldId</code>.
  115. For example <a href="http://couchdb.apache.org/"
  116. target="_blank">CouchDB</a> uses the field
  117. <code>"_id"</code> to identify documents.
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>type</td>
  122. <td>Object.&lt;String,&nbsp;String&gt;</td>
  123. <td>none</td>
  124. <td>
  125. An object containing field names as key, and data types as
  126. value. By default, the type of the properties of items are left
  127. unchanged. Item properties can be normalized by specifying a
  128. field type. This is useful for example to automatically convert
  129. stringified dates coming from a server into JavaScript Date
  130. objects. The available data types are listed in section
  131. <a href="#Data_Types">Data Types</a>.
  132. </td>
  133. </tr>
  134. </table>
  135. <h2 id="Methods">Methods</h2>
  136. <p>DataSet contains the following methods.</p>
  137. <table>
  138. <colgroup>
  139. <col width="200">
  140. </colgroup>
  141. <tr>
  142. <th>Method</th>
  143. <th>Return Type</th>
  144. <th>Description</th>
  145. </tr>
  146. <tr>
  147. <td>add(data [, senderId])</td>
  148. <td>Number[]</td>
  149. <td>Add one or multiple items to the DataSet. <code>data</code> can be a single item or an array with items. Adding an item will fail when there already is an item with the same id. The function returns an array with the ids of the added items. See section <a href="#Data_Manipulation">Data Manipulation</a>.</td>
  150. </tr>
  151. <tr>
  152. <td>clear([senderId])</td>
  153. <td>Number[]</td>
  154. <td>Clear all data from the DataSet. The function returns an array with the ids of the removed items.</td>
  155. </tr>
  156. <tr>
  157. <td>distinct(field)</td>
  158. <td>Array</td>
  159. <td>Find all distinct values of a specified field. Returns an unordered array containing all distinct values. If data items do not contain the specified field are ignored.</td>
  160. </tr>
  161. <tr>
  162. <td>forEach(callback [, options])</td>
  163. <td>none</td>
  164. <td>
  165. Execute a callback function for every item in the dataset.
  166. The available options are described in section <a href="#Data_Selection">Data Selection</a>.
  167. </td>
  168. </tr>
  169. <tr>
  170. <td>
  171. get([options] [, data])<br>
  172. get(id [,options] [, data])<br>
  173. get(ids [, options] [, data])
  174. </td>
  175. <td>Object | Array | DataTable</td>
  176. <td>
  177. Get a single item, multiple items, or all items from the DataSet.
  178. Usage examples can be found in section <a href="#Getting_Data">Getting Data</a>, and the available <code>options</code> are described in section <a href="#Data_Selection">Data Selection</a>. If parameter <code>data</code> is provided, items will be appended to this array or table, which is required in case of Google DataTable.
  179. </td>
  180. </tr>
  181. <tr>
  182. <td>
  183. getDataSet()
  184. </td>
  185. <td>DataSet</td>
  186. <td>
  187. Get the DataSet itself. In case of a DataView, this function does not
  188. return the DataSet to which the DataView is connected.
  189. </td>
  190. </tr>
  191. <tr>
  192. <td>
  193. getIds([options])
  194. </td>
  195. <td>Number[]</td>
  196. <td>
  197. Get ids of all items or of a filtered set of items.
  198. Available <code>options</code> are described in section <a href="#Data_Selection">Data Selection</a>, except that options <code>fields</code> and <code>type</code> are not applicable in case of <code>getIds</code>.
  199. </td>
  200. </tr>
  201. <tr>
  202. <td>map(callback [, options])</td>
  203. <td>Array</td>
  204. <td>
  205. Map every item in the DataSet.
  206. The available options are described in section <a href="#Data_Selection">Data Selection</a>.
  207. </td>
  208. </tr>
  209. <tr>
  210. <td>max(field)</td>
  211. <td>Object | null</td>
  212. <td>
  213. Find the item with maximum value of specified field. Returns <code>null</code> if no item is found.
  214. </td>
  215. </tr>
  216. <tr>
  217. <td>min(field)</td>
  218. <td>Object | null</td>
  219. <td>
  220. Find the item with minimum value of specified field. Returns <code>null</code> if no item is found.
  221. </td>
  222. </tr>
  223. <tr>
  224. <td>off(event, callback)</td>
  225. <td>none</td>
  226. <td>
  227. Unsubscribe from an event, remove an event listener. See section <a href="#Subscriptions">Subscriptions</a>.
  228. </td>
  229. </tr>
  230. <tr>
  231. <td>on(event, callback)</td>
  232. <td>none</td>
  233. <td>
  234. Subscribe to an event, add an event listener. See section <a href="#Subscriptions">Subscriptions</a>.
  235. </td>
  236. </tr>
  237. <tr>
  238. <td>
  239. remove(id [, senderId])<br>
  240. remove(ids [, senderId])
  241. </td>
  242. <td>Number[]</td>
  243. <td>
  244. Remove one or multiple items by id or by the items themselves. Returns an array with the ids of the removed items. See section <a href="#Data_Manipulation">Data Manipulation</a>.
  245. </td>
  246. </tr>
  247. <tr>
  248. <td>
  249. update(data [, senderId])
  250. </td>
  251. <td>Number[]</td>
  252. <td>
  253. Update on ore multiple existing items. <code>data</code> can be a single item or an array with items. When an item doesn't exist, it will be created. Returns an array with the ids of the removed items. See section <a href="#Data_Manipulation">Data Manipulation</a>.
  254. </td>
  255. </tr>
  256. </table>
  257. <h2 id="Subscriptions">Subscriptions</h2>
  258. <p>
  259. One can subscribe on changes in a DataSet.
  260. A subscription can be created using the method <code>on</code>,
  261. and removed with <code>off</code>.
  262. </p>
  263. <pre class="prettyprint lang-js">
  264. // create a DataSet
  265. var data = new vis.DataSet();
  266. // subscribe to any change in the DataSet
  267. data.on('*', function (event, properties, senderId) {
  268. console.log('event:', event, 'properties:', properties, 'senderId:', senderId);
  269. });
  270. // add an item
  271. data.add({id: 1, text: 'item 1'}); // triggers an 'add' event
  272. data.update({id: 1, text: 'item 1 (updated)'}); // triggers an 'update' event
  273. data.remove(1); // triggers an 'remove' event
  274. </pre>
  275. <h3 id="On">On</h3>
  276. <p>
  277. Subscribe to an event.
  278. </p>
  279. Syntax:
  280. <pre class="prettyprint lang-js">DataSet.on(event, callback)</pre>
  281. Where:
  282. <ul>
  283. <li>
  284. <code>event</code> is a String containing any of the events listed
  285. in section <a href="#Events">Events</a>.
  286. </li>
  287. <li>
  288. <code>callback</code> is a callback function which will be called
  289. each time the event occurs. The callback function is described in
  290. section <a href="#Callback">Callback</a>.
  291. </li>
  292. </ul>
  293. <h3 id="Off">Off</h3>
  294. <p>
  295. Unsubscribe from an event.
  296. </p>
  297. Syntax:
  298. <pre class="prettyprint lang-js">DataSet.off(event, callback)</pre>
  299. Where <code>event</code> and <code>callback</code> correspond with the
  300. parameters used to <a href="#On">subscribe</a> to the event.
  301. <h3 id="Events">Events</h3>
  302. <p>
  303. The following events are available for subscription:
  304. </p>
  305. <table>
  306. <tr>
  307. <th>Event</th>
  308. <th>Description</th>
  309. </tr>
  310. <tr>
  311. <td>add</td>
  312. <td>
  313. The <code>add</code> event is triggered when an item
  314. or a set of items is added, or when an item is updated while
  315. not yet existing.
  316. </td>
  317. </tr>
  318. <tr>
  319. <td>update</td>
  320. <td>
  321. The <code>update</code> event is triggered when an existing item
  322. or a set of existing items is updated.
  323. </td>
  324. </tr>
  325. <tr>
  326. <td>remove</td>
  327. <td>
  328. The <code>remove</code> event is triggered when an item
  329. or a set of items is removed.
  330. </td>
  331. </tr>
  332. <tr>
  333. <td>*</td>
  334. <td>
  335. The <code>*</code> event is triggered when any of the events
  336. <code>add</code>, <code>update</code>, and <code>remove</code>
  337. occurs.
  338. </td>
  339. </tr>
  340. </table>
  341. <h3 id="Callback">Callback</h3>
  342. <p>
  343. The callback functions of subscribers are called with the following
  344. parameters:
  345. </p>
  346. <pre class="prettyprint lang-js">
  347. function (event, properties, senderId) {
  348. // handle the event
  349. });
  350. </pre>
  351. <p>
  352. where the parameters are defined as
  353. </p>
  354. <table>
  355. <tr>
  356. <th>Parameter</th>
  357. <th>Type</th>
  358. <th>Description</th>
  359. </tr>
  360. <tr>
  361. <td>event</td>
  362. <td>String</td>
  363. <td>
  364. Any of the available events: <code>add</code>,
  365. <code>update</code>, or <code>remove</code>.
  366. </td>
  367. </tr>
  368. <tr>
  369. <td>properties</td>
  370. <td>Object&nbsp;|&nbsp;null</td>
  371. <td>
  372. Optional properties providing more information on the event.
  373. In case of the events <code>add</code>,
  374. <code>update</code>, and <code>remove</code>,
  375. <code>properties</code> is always an object containing a property
  376. <code>items</code>, which contains an array with the ids of the affected
  377. items. The <code>update</code> event has an extra field <code>data</code>
  378. containing the original data of the updated items, i.e. the gives the
  379. changed fields of the changed items.
  380. </td>
  381. </tr>
  382. <tr>
  383. <td>senderId</td>
  384. <td>String&nbsp;|&nbsp;Number</td>
  385. <td>
  386. An senderId, optionally provided by the application code
  387. which triggered the event. If senderId is not provided, the
  388. argument will be <code>null</code>.
  389. </td>
  390. </tr>
  391. </table>
  392. <h2 id="Data_Manipulation">Data Manipulation</h2>
  393. <p>
  394. The data in a DataSet can be manipulated using the methods
  395. <a href="#Add"><code>add</code></a>,
  396. <a href="#Update"><code>update</code></a>,
  397. and <a href="#Remove"><code>remove</code></a>.
  398. The DataSet can be emptied using the method
  399. <a href="#Clear"><code>clear</code></a>.
  400. </p>
  401. <pre class="prettyprint lang-js">
  402. // create a DataSet
  403. var data = new vis.DataSet();
  404. // add items
  405. data.add([
  406. {id: 1, text: 'item 1'},
  407. {id: 2, text: 'item 2'},
  408. {id: 3, text: 'item 3'}
  409. ]);
  410. // update an item
  411. data.update({id: 2, text: 'item 2 (updated)'});
  412. // remove an item
  413. data.remove(3);
  414. </pre>
  415. <h3 id="Add">Add</h3>
  416. <p>
  417. Add a data item or an array with items.
  418. </p>
  419. Syntax:
  420. <pre class="prettyprint lang-js">var addedIds = DataSet.add(data [, senderId])</pre>
  421. The argument <code>data</code> can contain:
  422. <ul>
  423. <li>
  424. An <code>Object</code> containing a single item to be
  425. added. The item must contain an id.
  426. </li>
  427. <li>
  428. An <code>Array</code> or
  429. <code>google.visualization.DataTable</code> containing
  430. a list with items to be added. Each item must contain
  431. an id.
  432. </li>
  433. </ul>
  434. <p>
  435. After the items are added to the DataSet, the DataSet will
  436. trigger an event <code>add</code>. When a <code>senderId</code>
  437. is provided, this id will be passed with the triggered
  438. event to all subscribers.
  439. </p>
  440. <p>
  441. The method will throw an Error when an item with the same id
  442. as any of the added items already exists.
  443. </p>
  444. <h3 id="Update">Update</h3>
  445. <p>
  446. Update a data item or an array with items.
  447. </p>
  448. Syntax:
  449. <pre class="prettyprint lang-js">var updatedIds = DataSet.update(data [, senderId])</pre>
  450. The argument <code>data</code> can contain:
  451. <ul>
  452. <li>
  453. An <code>Object</code> containing a single item to be
  454. updated. The item must contain an id.
  455. </li>
  456. <li>
  457. An <code>Array</code> or
  458. <code>google.visualization.DataTable</code> containing
  459. a list with items to be updated. Each item must contain
  460. an id.
  461. </li>
  462. </ul>
  463. <p>
  464. The provided properties will be merged in the existing item.
  465. When an item does not exist, it will be created.
  466. </p>
  467. <p>
  468. After the items are updated, the DataSet will
  469. trigger an event <code>add</code> for the added items, and
  470. an event <code>update</code>. When a <code>senderId</code>
  471. is provided, this id will be passed with the triggered
  472. event to all subscribers.
  473. </p>
  474. <h3 id="Remove">Remove</h3>
  475. <p>
  476. Remove a data item or an array with items.
  477. </p>
  478. Syntax:
  479. <pre class="prettyprint lang-js">var removedIds = DataSet.remove(id [, senderId])</pre>
  480. <p>
  481. The argument <code>id</code> can be:
  482. </p>
  483. <ul>
  484. <li>
  485. A <code>Number</code> or <code>String</code> containing the id
  486. of a single item to be removed.
  487. </li>
  488. <li>
  489. An <code>Object</code> containing the item to be deleted.
  490. The item will be deleted by its id.
  491. </li>
  492. <li>
  493. An Array containing ids or items to be removed.
  494. </li>
  495. </ul>
  496. <p>
  497. The method ignores removal of non-existing items, and returns an array
  498. containing the ids of the items which are actually removed from the
  499. DataSet.
  500. </p>
  501. <p>
  502. After the items are removed, the DataSet will
  503. trigger an event <code>remove</code> for the removed items.
  504. When a <code>senderId</code> is provided, this id will be passed with
  505. the triggered event to all subscribers.
  506. </p>
  507. <h3 id="Clear">Clear</h3>
  508. <p>
  509. Clear the complete DataSet.
  510. </p>
  511. Syntax:
  512. <pre class="prettyprint lang-js">var removedIds = DataSet.clear([senderId])</pre>
  513. <p>
  514. After the items are removed, the DataSet will
  515. trigger an event <code>remove</code> for all removed items.
  516. When a <code>senderId</code> is provided, this id will be passed with
  517. the triggered event to all subscribers.
  518. </p>
  519. <h2 id="Data_Selection">Data Selection</h2>
  520. <p>
  521. The DataSet contains functionality to format, filter, and sort data retrieved via the
  522. methods <code>get</code>, <code>getIds</code>, <code>forEach</code>, and <code>map</code>. These methods have the following syntax:
  523. </p>
  524. <pre class="prettyprint lang-js">
  525. DataSet.get([id] [, options] [, data]);
  526. DataSet.getIds([options]);
  527. DataSet.forEach(callback [, options]);
  528. DataSet.map(callback [, options]);
  529. </pre>
  530. <p>
  531. Where <code>options</code> is an Object which can have the following
  532. properties:
  533. </p>
  534. <table>
  535. <tr>
  536. <th>Name</th>
  537. <th>Type</th>
  538. <th>Description</th>
  539. </tr>
  540. <tr>
  541. <td>fields</td>
  542. <td>String[&nbsp;]</td>
  543. <td>
  544. An array with field names.
  545. By default, all properties of the items are emitted.
  546. When <code>fields</code> is defined, only the properties
  547. whose name is specified in <code>fields</code> will be included
  548. in the returned items.
  549. </td>
  550. </tr>
  551. <tr>
  552. <td>type</td>
  553. <td>Object.&lt;String,&nbsp;String&gt;</td>
  554. <td>
  555. An object containing field names as key, and data types as value.
  556. By default, the type of the properties of an item are left
  557. unchanged. When a field type is specified, this field in the
  558. items will be converted to the specified type. This can be used
  559. for example to convert ISO strings containing a date to a
  560. JavaScript Date object, or convert strings to numbers or vice
  561. versa. The available data types are listed in section
  562. <a href="#Data_Types">Data Types</a>.
  563. </td>
  564. </tr>
  565. <tr>
  566. <td>filter</td>
  567. <td>Function</td>
  568. <td>Items can be filtered on specific properties by providing a filter
  569. function. A filter function is executed for each of the items in the
  570. DataSet, and is called with the item as parameter. The function must
  571. return a boolean. All items for which the filter function returns
  572. true will be emitted.
  573. See section <a href="#Data_Filtering">Data Filtering</a>.</td>
  574. </tr>
  575. <tr>
  576. <td>order</td>
  577. <td>String | Function</td>
  578. <td>Order the items by a field name or custom sort function.</td>
  579. </tr>
  580. <tr>
  581. <td>returnType</td>
  582. <td>String</td>
  583. <td>Determine the type of output of the get function. Allowed values are <code>Array | Object | DataTable</code>.
  584. The <code>DataTable</code> refers to a Google DataTable. The default returnType is an array. The object type will return a JSON object with the ID's as keys.</td>
  585. </tr>
  586. </table>
  587. <p>
  588. The following example demonstrates formatting properties and filtering
  589. properties from items.
  590. </p>
  591. <pre class="prettyprint lang-js">
  592. // create a DataSet
  593. var data = new vis.DataSet();
  594. data.add([
  595. {id: 1, text: 'item 1', date: '2013-06-20', group: 1, first: true},
  596. {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
  597. {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
  598. {id: 4, text: 'item 4'}
  599. ]);
  600. // retrieve formatted items
  601. var items = data.get({
  602. fields: ['id', 'date', 'group'], // output the specified fields only
  603. type: {
  604. date: 'Date', // convert the date fields to Date objects
  605. group: 'String' // convert the group fields to Strings
  606. }
  607. });
  608. </pre>
  609. <h3 id="Getting_Data">Getting Data</h3>
  610. <p>
  611. Data can be retrieved from the DataSet using the method <code>get</code>.
  612. This method can return a single item or a list with items.
  613. </p>
  614. <p>A single item can be retrieved by its id:</p>
  615. <pre class="prettyprint lang-js">
  616. var item1 = dataset.get(1);
  617. </pre>
  618. <p>A selection of items can be retrieved by providing an array with ids:</p>
  619. <pre class="prettyprint lang-js">
  620. var items = dataset.get([1, 3, 4]); // retrieve items 1, 3, and 4
  621. </pre>
  622. <p>All items can be retrieved by simply calling <code>get</code> without
  623. specifying an id:</p>
  624. <pre class="prettyprint lang-js">
  625. var items = dataset.get(); // retrieve all items
  626. </pre>
  627. <h3 id="Data_Filtering">Data Filtering</h3>
  628. <p>
  629. Items can be filtered on specific properties by providing a filter
  630. function. A filter function is executed for each of the items in the
  631. DataSet, and is called with the item as parameter. The function must
  632. return a boolean. All items for which the filter function returns
  633. true will be emitted.
  634. </p>
  635. <pre class="prettyprint lang-js">
  636. // retrieve all items having a property group with value 2
  637. var group2 = dataset.get({
  638. filter: function (item) {
  639. return (item.group == 2);
  640. }
  641. });
  642. // retrieve all items having a property balance with a value above zero
  643. var positiveBalance = dataset.get({
  644. filter: function (item) {
  645. return (item.balance > 0);
  646. }
  647. });
  648. </pre>
  649. <h3 id="Data_Types">Data Types</h3>
  650. <p>
  651. DataSet supports the following data types:
  652. </p>
  653. <table style="width: 100%">
  654. <tr>
  655. <th>Name</th>
  656. <th>Description</th>
  657. <th>Examples</th>
  658. </tr>
  659. <tr>
  660. <td>Boolean</td>
  661. <td>A JavaScript Boolean</td>
  662. <td>
  663. <code>true</code><br>
  664. <code>false</code>
  665. </td>
  666. </tr>
  667. <tr>
  668. <td>Number</td>
  669. <td>A JavaScript Number</td>
  670. <td>
  671. <code>32</code><br>
  672. <code>2.4</code>
  673. </td>
  674. </tr>
  675. <tr>
  676. <td>String</td>
  677. <td>A JavaScript String</td>
  678. <td>
  679. <code>"hello world"</code><br>
  680. <code>"2013-06-28"</code>
  681. </td>
  682. </tr>
  683. <tr>
  684. <td>Date</td>
  685. <td>A JavaScript Date object</td>
  686. <td>
  687. <code>new Date()</code><br>
  688. <code>new Date(2013, 5, 28)</code><br>
  689. <code>new Date(1372370400000)</code>
  690. </td>
  691. </tr>
  692. <tr>
  693. <td>Moment</td>
  694. <td>A Moment object, created with
  695. <a href="http://momentjs.com/" target="_blank">moment.js</a></td>
  696. <td>
  697. <code>moment()</code><br>
  698. <code>moment('2013-06-28')</code>
  699. </td>
  700. </tr>
  701. <tr>
  702. <td>ISODate</td>
  703. <td>A string containing an ISO Date</td>
  704. <td>
  705. <code>new Date().toISOString()</code><br>
  706. <code>"2013-06-27T22:00:00.000Z"</code>
  707. </td>
  708. </tr>
  709. <tr>
  710. <td>ASPDate</td>
  711. <td>A string containing an ASP Date</td>
  712. <td>
  713. <code>"/Date(1372370400000)/"</code><br>
  714. <code>"/Date(1198908717056-0700)/"</code>
  715. </td>
  716. </tr>
  717. </table>
  718. <h2 id="Data_Policy">Data Policy</h2>
  719. <p>
  720. All code and data is processed and rendered in the browser.
  721. No data is sent to any server.
  722. </p>
  723. </div>
  724. </body>
  725. </html>