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.

59 lines
1.6 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Group 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. items.add([
  25. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)},
  26. {id: 2, content: 'item 2', start: now.clone().add('days', -2)},
  27. {id: 3, content: 'item 3', start: now.clone().add('days', 2)},
  28. {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()},
  29. {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'},
  30. {id: 6, content: 'item 6', start: now.clone().add('days', 11)}
  31. ]);
  32. var groups = new vis.DataSet();
  33. groups.add([
  34. {id: 1, content: 'Group 1'},
  35. {id: 2, content: 'Group 2'},
  36. {id: 3, content: 'Group 3'},
  37. {id: 4, content: 'Group 4'}
  38. ]);
  39. var container = document.getElementById('visualization');
  40. var options = {
  41. start: now.clone().add('days', -3),
  42. end: now.clone().add('days', 7),
  43. //height: '100%'
  44. };
  45. var timeline = new vis.Timeline(container);
  46. timeline.setOptions(options);
  47. timeline.setGroups(groups);
  48. timeline.setItems(items);
  49. </script>
  50. </body>
  51. </html>