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.

57 lines
1.5 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  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. height: 100%;
  10. margin: 0;
  11. padding: 0;
  12. }
  13. #visualization {
  14. box-sizing: border-box;
  15. width: 100%;
  16. height: 100%;
  17. }
  18. </style>
  19. <script src="../../vis.js"></script>
  20. </head>
  21. <body>
  22. <div id="visualization"></div>
  23. <script>
  24. var now = moment().minutes(0).seconds(0).milliseconds(0);
  25. // create a dataset with items
  26. var items = new vis.DataSet({
  27. convert: {
  28. start: 'Date',
  29. end: 'Date'
  30. }
  31. });
  32. items.add([
  33. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)},
  34. {id: 2, content: 'item 2', start: now.clone().add('days', -2)},
  35. {id: 3, content: 'item 3', start: now.clone().add('days', 2)},
  36. {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()},
  37. {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'},
  38. {id: 6, content: 'item 6', start: now.clone().add('days', 11)}
  39. ]);
  40. var container = document.getElementById('visualization');
  41. var options = {
  42. start: now.clone().add('days', -3),
  43. end: now.clone().add('days', 7),
  44. orientation: 'top',
  45. height: '100%'
  46. };
  47. var timeline = new vis.Timeline(container, items, options);
  48. </script>
  49. </body>
  50. </html>