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.

71 lines
1.8 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. // allow selecting multiple items using ctrl+click, shift+click, or hold.
  41. multiselect: true,
  42. // allow manipulation of items
  43. editable: true,
  44. /* alternatively, enable/disable individual actions:
  45. editable: {
  46. add: true,
  47. updateTime: true,
  48. updateGroup: true,
  49. remove: true
  50. },
  51. */
  52. showCurrentTime: true
  53. };
  54. var timeline = new vis.Timeline(container, items, options);
  55. </script>
  56. </body>
  57. </html>