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.

66 lines
1.7 KiB

11 years ago
11 years ago
11 years ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Manipulation example</title>
  5. <style>
  6. body, html {
  7. font-family: arial, sans-serif;
  8. font-size: 11pt;
  9. }
  10. </style>
  11. <script src="../../dist/vis.js"></script>
  12. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  13. <script src="../googleAnalytics.js"></script>
  14. </head>
  15. <body>
  16. <p>An editable timeline allows to drag items around, create new items, and remove items.</p>
  17. <div id="visualization"></div>
  18. <script>
  19. // create a dataset with items
  20. // we specify the type of the fields `start` and `end` here to be strings
  21. // containing an ISO date. The fields will be outputted as ISO dates
  22. // automatically getting data from the DataSet via items.get().
  23. var items = new vis.DataSet({
  24. type: { start: 'ISODate', end: 'ISODate' }
  25. });
  26. // add items to the DataSet
  27. items.add([
  28. {id: 1, content: 'item 1<br>start', start: '2014-01-23'},
  29. {id: 2, content: 'item 2', start: '2014-01-18'},
  30. {id: 3, content: 'item 3', start: '2014-01-21'},
  31. {id: 4, content: 'item 4', start: '2014-01-19', end: '2014-01-24'},
  32. {id: 5, content: 'item 5', start: '2014-01-28', type:'point'},
  33. {id: 6, content: 'item 6', start: '2014-01-26'}
  34. ]);
  35. var container = document.getElementById('visualization');
  36. var options = {
  37. start: '2014-01-10',
  38. end: '2014-02-10',
  39. height: '300px',
  40. editable: true,
  41. /* alternatively, enable/disable individual actions:
  42. editable: {
  43. add: true,
  44. updateTime: true,
  45. updateGroup: true,
  46. remove: true
  47. },
  48. */
  49. showCurrentTime: true
  50. };
  51. var timeline = new vis.Timeline(container, items, options);
  52. </script>
  53. </body>
  54. </html>