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.

53 lines
1.4 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Dataset example</title>
  5. <style>
  6. body, html {
  7. font-family: arial, sans-serif;
  8. font-size: 11pt;
  9. }
  10. #visualization {
  11. box-sizing: border-box;
  12. width: 100%;
  13. height: 300px;
  14. }
  15. </style>
  16. <script src="../../vis.js"></script>
  17. </head>
  18. <body>
  19. <div id="visualization"></div>
  20. <script>
  21. var now = moment().minutes(0).seconds(0).milliseconds(0);
  22. // create a dataset with items
  23. var items = new vis.DataSet({
  24. fieldTypes: {
  25. start: 'Date',
  26. end: 'Date'
  27. }
  28. });
  29. items.add([
  30. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)},
  31. {id: 2, content: 'item 2', start: now.clone().add('days', -2)},
  32. {id: 3, content: 'item 3', start: now.clone().add('days', 2)},
  33. {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()},
  34. {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'},
  35. {id: 6, content: 'item 6', start: now.clone().add('days', 11)}
  36. ]);
  37. var container = document.getElementById('visualization');
  38. var options = {
  39. start: now.clone().add('days', -3),
  40. end: now.clone().add('days', 7),
  41. height: '100%'
  42. };
  43. var timeline = new vis.Timeline(container, items, options);
  44. </script>
  45. </body>
  46. </html>