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.

865 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 data to the DataSet. 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> isprovided, 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 on ore 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(id [, senderId])<br>
  250. update(ids [, senderId])
  251. </td>
  252. <td>Number[]</td>
  253. <td>
  254. Update on ore existing 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>.
  255. </td>
  256. </tr>
  257. </table>
  258. <h2 id="Subscriptions">Subscriptions</h2>
  259. <p>
  260. One can subscribe on changes in a DataSet.
  261. A subscription can be created using the method <code>on</code>,
  262. and removed with <code>off</code>.
  263. </p>
  264. <pre class="prettyprint lang-js">
  265. // create a DataSet
  266. var data = new vis.DataSet();
  267. // subscribe to any change in the DataSet
  268. data.on('*', function (event, properties, senderId) {
  269. console.log('event:', event, 'properties:', properties, 'senderId:', senderId);
  270. });
  271. // add an item
  272. data.add({id: 1, text: 'item 1'}); // triggers an 'add' event
  273. data.update({id: 1, text: 'item 1 (updated)'}); // triggers an 'update' event
  274. data.remove(1); // triggers an 'remove' event
  275. </pre>
  276. <h3 id="On">On</h3>
  277. <p>
  278. Subscribe to an event.
  279. </p>
  280. Syntax:
  281. <pre class="prettyprint lang-js">DataSet.on(event, callback)</pre>
  282. Where:
  283. <ul>
  284. <li>
  285. <code>event</code> is a String containing any of the events listed
  286. in section <a href="#Events">Events</a>.
  287. </li>
  288. <li>
  289. <code>callback</code> is a callback function which will be called
  290. each time the event occurs. The callback function is described in
  291. section <a href="#Callback">Callback</a>.
  292. </li>
  293. </ul>
  294. <h3 id="Off">Off</h3>
  295. <p>
  296. Unsubscribe from an event.
  297. </p>
  298. Syntax:
  299. <pre class="prettyprint lang-js">DataSet.off(event, callback)</pre>
  300. Where <code>event</code> and <code>callback</code> correspond with the
  301. parameters used to <a href="#On">subscribe</a> to the event.
  302. <h3 id="Events">Events</h3>
  303. <p>
  304. The following events are available for subscription:
  305. </p>
  306. <table>
  307. <tr>
  308. <th>Event</th>
  309. <th>Description</th>
  310. </tr>
  311. <tr>
  312. <td>add</td>
  313. <td>
  314. The <code>add</code> event is triggered when an item
  315. or a set of items is added, or when an item is updated while
  316. not yet existing.
  317. </td>
  318. </tr>
  319. <tr>
  320. <td>update</td>
  321. <td>
  322. The <code>update</code> event is triggered when an existing item
  323. or a set of existing items is updated.
  324. </td>
  325. </tr>
  326. <tr>
  327. <td>remove</td>
  328. <td>
  329. The <code>remove</code> event is triggered when an item
  330. or a set of items is removed.
  331. </td>
  332. </tr>
  333. <tr>
  334. <td>*</td>
  335. <td>
  336. The <code>*</code> event is triggered when any of the events
  337. <code>add</code>, <code>update</code>, and <code>remove</code>
  338. occurs.
  339. </td>
  340. </tr>
  341. </table>
  342. <h3 id="Callback">Callback</h3>
  343. <p>
  344. The callback functions of subscribers are called with the following
  345. parameters:
  346. </p>
  347. <pre class="prettyprint lang-js">
  348. function (event, properties, senderId) {
  349. // handle the event
  350. });
  351. </pre>
  352. <p>
  353. where the parameters are defined as
  354. </p>
  355. <table>
  356. <tr>
  357. <th>Parameter</th>
  358. <th>Type</th>
  359. <th>Description</th>
  360. </tr>
  361. <tr>
  362. <td>event</td>
  363. <td>String</td>
  364. <td>
  365. Any of the available events: <code>add</code>,
  366. <code>update</code>, or <code>remove</code>.
  367. </td>
  368. </tr>
  369. <tr>
  370. <td>properties</td>
  371. <td>Object&nbsp;|&nbsp;null</td>
  372. <td>
  373. Optional properties providing more information on the event.
  374. In case of the events <code>add</code>,
  375. <code>update</code>, and <code>remove</code>,
  376. <code>properties</code> is always an object containing a property
  377. <code>items</code>, which contains an array with the ids of the affected
  378. items. The <code>update</code> event has an extra field <code>data</code>
  379. containing the original data of the updated items, i.e. the gives the
  380. changed fields of the changed items.
  381. </td>
  382. </tr>
  383. <tr>
  384. <td>senderId</td>
  385. <td>String&nbsp;|&nbsp;Number</td>
  386. <td>
  387. An senderId, optionally provided by the application code
  388. which triggered the event. If senderId is not provided, the
  389. argument will be <code>null</code>.
  390. </td>
  391. </tr>
  392. </table>
  393. <h2 id="Data_Manipulation">Data Manipulation</h2>
  394. <p>
  395. The data in a DataSet can be manipulated using the methods
  396. <a href="#Add"><code>add</code></a>,
  397. <a href="#Update"><code>update</code></a>,
  398. and <a href="#Remove"><code>remove</code></a>.
  399. The DataSet can be emptied using the method
  400. <a href="#Clear"><code>clear</code></a>.
  401. </p>
  402. <pre class="prettyprint lang-js">
  403. // create a DataSet
  404. var data = new vis.DataSet();
  405. // add items
  406. data.add([
  407. {id: 1, text: 'item 1'},
  408. {id: 2, text: 'item 2'},
  409. {id: 3, text: 'item 3'}
  410. ]);
  411. // update an item
  412. data.update({id: 2, text: 'item 2 (updated)'});
  413. // remove an item
  414. data.remove(3);
  415. </pre>
  416. <h3 id="Add">Add</h3>
  417. <p>
  418. Add a data item or an array with items.
  419. </p>
  420. Syntax:
  421. <pre class="prettyprint lang-js">var addedIds = DataSet.add(data [, senderId])</pre>
  422. The argument <code>data</code> can contain:
  423. <ul>
  424. <li>
  425. An <code>Object</code> containing a single item to be
  426. added. The item must contain an id.
  427. </li>
  428. <li>
  429. An <code>Array</code> or
  430. <code>google.visualization.DataTable</code> containing
  431. a list with items to be added. Each item must contain
  432. an id.
  433. </li>
  434. </ul>
  435. <p>
  436. After the items are added to the DataSet, the DataSet will
  437. trigger an event <code>add</code>. When a <code>senderId</code>
  438. is provided, this id will be passed with the triggered
  439. event to all subscribers.
  440. </p>
  441. <p>
  442. The method will throw an Error when an item with the same id
  443. as any of the added items already exists.
  444. </p>
  445. <h3 id="Update">Update</h3>
  446. <p>
  447. Update a data item or an array with items.
  448. </p>
  449. Syntax:
  450. <pre class="prettyprint lang-js">var updatedIds = DataSet.update(data [, senderId])</pre>
  451. The argument <code>data</code> can contain:
  452. <ul>
  453. <li>
  454. An <code>Object</code> containing a single item to be
  455. updated. The item must contain an id.
  456. </li>
  457. <li>
  458. An <code>Array</code> or
  459. <code>google.visualization.DataTable</code> containing
  460. a list with items to be updated. Each item must contain
  461. an id.
  462. </li>
  463. </ul>
  464. <p>
  465. The provided properties will be merged in the existing item.
  466. When an item does not exist, it will be created.
  467. </p>
  468. <p>
  469. After the items are updated, the DataSet will
  470. trigger an event <code>add</code> for the added items, and
  471. an event <code>update</code>. When a <code>senderId</code>
  472. is provided, this id will be passed with the triggered
  473. event to all subscribers.
  474. </p>
  475. <h3 id="Remove">Remove</h3>
  476. <p>
  477. Remove a data item or an array with items.
  478. </p>
  479. Syntax:
  480. <pre class="prettyprint lang-js">var removedIds = DataSet.remove(id [, senderId])</pre>
  481. <p>
  482. The argument <code>id</code> can be:
  483. </p>
  484. <ul>
  485. <li>
  486. A <code>Number</code> or <code>String</code> containing the id
  487. of a single item to be removed.
  488. </li>
  489. <li>
  490. An <code>Object</code> containing the item to be deleted.
  491. The item will be deleted by its id.
  492. </li>
  493. <li>
  494. An Array containing ids or items to be removed.
  495. </li>
  496. </ul>
  497. <p>
  498. The method ignores removal of non-existing items, and returns an array
  499. containing the ids of the items which are actually removed from the
  500. DataSet.
  501. </p>
  502. <p>
  503. After the items are removed, the DataSet will
  504. trigger an event <code>remove</code> for the removed items.
  505. When a <code>senderId</code> is provided, this id will be passed with
  506. the triggered event to all subscribers.
  507. </p>
  508. <h3 id="Clear">Clear</h3>
  509. <p>
  510. Clear the complete DataSet.
  511. </p>
  512. Syntax:
  513. <pre class="prettyprint lang-js">var removedIds = DataSet.clear([senderId])</pre>
  514. <p>
  515. After the items are removed, the DataSet will
  516. trigger an event <code>remove</code> for all removed items.
  517. When a <code>senderId</code> is provided, this id will be passed with
  518. the triggered event to all subscribers.
  519. </p>
  520. <h2 id="Data_Selection">Data Selection</h2>
  521. <p>
  522. The DataSet contains functionality to format, filter, and sort data retrieved via the
  523. methods <code>get</code>, <code>getIds</code>, <code>forEach</code>, and <code>map</code>. These methods have the following syntax:
  524. </p>
  525. <pre class="prettyprint lang-js">
  526. DataSet.get([id] [, options] [, data]);
  527. DataSet.getIds([options]);
  528. DataSet.forEach(callback [, options]);
  529. DataSet.map(callback [, options]);
  530. </pre>
  531. <p>
  532. Where <code>options</code> is an Object which can have the following
  533. properties:
  534. </p>
  535. <table>
  536. <tr>
  537. <th>Name</th>
  538. <th>Type</th>
  539. <th>Description</th>
  540. </tr>
  541. <tr>
  542. <td>fields</td>
  543. <td>String[&nbsp;]</td>
  544. <td>
  545. An array with field names.
  546. By default, all properties of the items are emitted.
  547. When <code>fields</code> is defined, only the properties
  548. whose name is specified in <code>fields</code> will be included
  549. in the returned items.
  550. </td>
  551. </tr>
  552. <tr>
  553. <td>type</td>
  554. <td>Object.&lt;String,&nbsp;String&gt;</td>
  555. <td>
  556. An object containing field names as key, and data types as value.
  557. By default, the type of the properties of an item are left
  558. unchanged. When a field type is specified, this field in the
  559. items will be converted to the specified type. This can be used
  560. for example to convert ISO strings containing a date to a
  561. JavaScript Date object, or convert strings to numbers or vice
  562. versa. The available data types are listed in section
  563. <a href="#Data_Types">Data Types</a>.
  564. </td>
  565. </tr>
  566. <tr>
  567. <td>filter</td>
  568. <td>Function</td>
  569. <td>Items can be filtered on specific properties by providing a filter
  570. function. A filter function is executed for each of the items in the
  571. DataSet, and is called with the item as parameter. The function must
  572. return a boolean. All items for which the filter function returns
  573. true will be emitted.
  574. See section <a href="#Data_Filtering">Data Filtering</a>.</td>
  575. </tr>
  576. <tr>
  577. <td>order</td>
  578. <td>String | Function</td>
  579. <td>Order the items by a field name or custom sort function.</td>
  580. </tr>
  581. <tr>
  582. <td>returnType</td>
  583. <td>String</td>
  584. <td>Determine the type of output of the get function. Allowed values are <code>Array | Object | DataTable</code>.
  585. 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>
  586. </tr>
  587. </table>
  588. <p>
  589. The following example demonstrates formatting properties and filtering
  590. properties from items.
  591. </p>
  592. <pre class="prettyprint lang-js">
  593. // create a DataSet
  594. var data = new vis.DataSet();
  595. data.add([
  596. {id: 1, text: 'item 1', date: '2013-06-20', group: 1, first: true},
  597. {id: 2, text: 'item 2', date: '2013-06-23', group: 2},
  598. {id: 3, text: 'item 3', date: '2013-06-25', group: 2},
  599. {id: 4, text: 'item 4'}
  600. ]);
  601. // retrieve formatted items
  602. var items = data.get({
  603. fields: ['id', 'date', 'group'], // output the specified fields only
  604. type: {
  605. date: 'Date', // convert the date fields to Date objects
  606. group: 'String' // convert the group fields to Strings
  607. }
  608. });
  609. </pre>
  610. <h3 id="Getting_Data">Getting Data</h3>
  611. <p>
  612. Data can be retrieved from the DataSet using the method <code>get</code>.
  613. This method can return a single item or a list with items.
  614. </p>
  615. <p>A single item can be retrieved by its id:</p>
  616. <pre class="prettyprint lang-js">
  617. var item1 = dataset.get(1);
  618. </pre>
  619. <p>A selection of items can be retrieved by providing an array with ids:</p>
  620. <pre class="prettyprint lang-js">
  621. var items = dataset.get([1, 3, 4]); // retrieve items 1, 3, and 4
  622. </pre>
  623. <p>All items can be retrieved by simply calling <code>get</code> without
  624. specifying an id:</p>
  625. <pre class="prettyprint lang-js">
  626. var items = dataset.get(); // retrieve all items
  627. </pre>
  628. <h3 id="Data_Filtering">Data Filtering</h3>
  629. <p>
  630. Items can be filtered on specific properties by providing a filter
  631. function. A filter function is executed for each of the items in the
  632. DataSet, and is called with the item as parameter. The function must
  633. return a boolean. All items for which the filter function returns
  634. true will be emitted.
  635. </p>
  636. <pre class="prettyprint lang-js">
  637. // retrieve all items having a property group with value 2
  638. var group2 = dataset.get({
  639. filter: function (item) {
  640. return (item.group == 2);
  641. }
  642. });
  643. // retrieve all items having a property balance with a value above zero
  644. var positiveBalance = dataset.get({
  645. filter: function (item) {
  646. return (item.balance > 0);
  647. }
  648. });
  649. </pre>
  650. <h3 id="Data_Types">Data Types</h3>
  651. <p>
  652. DataSet supports the following data types:
  653. </p>
  654. <table style="width: 100%">
  655. <tr>
  656. <th>Name</th>
  657. <th>Description</th>
  658. <th>Examples</th>
  659. </tr>
  660. <tr>
  661. <td>Boolean</td>
  662. <td>A JavaScript Boolean</td>
  663. <td>
  664. <code>true</code><br>
  665. <code>false</code>
  666. </td>
  667. </tr>
  668. <tr>
  669. <td>Number</td>
  670. <td>A JavaScript Number</td>
  671. <td>
  672. <code>32</code><br>
  673. <code>2.4</code>
  674. </td>
  675. </tr>
  676. <tr>
  677. <td>String</td>
  678. <td>A JavaScript String</td>
  679. <td>
  680. <code>"hello world"</code><br>
  681. <code>"2013-06-28"</code>
  682. </td>
  683. </tr>
  684. <tr>
  685. <td>Date</td>
  686. <td>A JavaScript Date object</td>
  687. <td>
  688. <code>new Date()</code><br>
  689. <code>new Date(2013, 5, 28)</code><br>
  690. <code>new Date(1372370400000)</code>
  691. </td>
  692. </tr>
  693. <tr>
  694. <td>Moment</td>
  695. <td>A Moment object, created with
  696. <a href="http://momentjs.com/" target="_blank">moment.js</a></td>
  697. <td>
  698. <code>moment()</code><br>
  699. <code>moment('2013-06-28')</code>
  700. </td>
  701. </tr>
  702. <tr>
  703. <td>ISODate</td>
  704. <td>A string containing an ISO Date</td>
  705. <td>
  706. <code>new Date().toISOString()</code><br>
  707. <code>"2013-06-27T22:00:00.000Z"</code>
  708. </td>
  709. </tr>
  710. <tr>
  711. <td>ASPDate</td>
  712. <td>A string containing an ASP Date</td>
  713. <td>
  714. <code>"/Date(1372370400000)/"</code><br>
  715. <code>"/Date(1198908717056-0700)/"</code>
  716. </td>
  717. </tr>
  718. </table>
  719. <h2 id="Data_Policy">Data Policy</h2>
  720. <p>
  721. All code and data is processed and rendered in the browser.
  722. No data is sent to any server.
  723. </p>
  724. </div>
  725. </body>
  726. </html>