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
2.0 KiB

11 years ago
11 years ago
11 years ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Interactive 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>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head>
  14. <body>
  15. <p>Drag items around, create new items, and remove items.</p>
  16. <div id="visualization"></div>
  17. <script>
  18. // create a dataset with items
  19. // we specify the type of the fields `start` and `end` here to be strings
  20. // containing an ISO date. The fields will be outputted as ISO dates
  21. // automatically getting data from the DataSet via items.get().
  22. var items = new vis.DataSet({
  23. type: { start: 'ISODate', end: 'ISODate' }
  24. });
  25. // add items to the DataSet
  26. items.add([
  27. {id: 1, content: 'item 1<br>start', start: '2014-01-23'},
  28. {id: 2, content: 'item 2', start: '2014-01-18'},
  29. {id: 3, content: 'item 3', start: '2014-01-21'},
  30. {id: 4, content: 'item 4', start: '2014-01-19', end: '2014-01-24'},
  31. {id: 5, content: 'item 5', start: '2014-01-28', type:'point'},
  32. {id: 6, content: 'item 6', start: '2014-01-26'}
  33. ]);
  34. var container = document.getElementById('visualization');
  35. var options = {
  36. start: '2014-01-10',
  37. end: '2014-02-10',
  38. orientation: 'top',
  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>