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.

61 lines
1.7 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. <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js -->
  20. <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script>
  21. <script src="../../vis.js"></script>
  22. </head>
  23. <body>
  24. <div id="visualization"></div>
  25. <script>
  26. var now = moment().minutes(0).seconds(0).milliseconds(0);
  27. // create a dataset with items
  28. var items = new vis.DataSet({
  29. convert: {
  30. start: 'Date',
  31. end: 'Date'
  32. }
  33. });
  34. items.add([
  35. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)},
  36. {id: 2, content: 'item 2', start: now.clone().add('days', -2)},
  37. {id: 3, content: 'item 3', start: now.clone().add('days', 2)},
  38. {id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()},
  39. {id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'},
  40. {id: 6, content: 'item 6', start: now.clone().add('days', 11)}
  41. ]);
  42. var container = document.getElementById('visualization');
  43. var options = {
  44. start: now.clone().add('days', -3),
  45. end: now.clone().add('days', 7),
  46. orientation: 'top',
  47. height: '100%',
  48. showCurrentTime: true
  49. };
  50. var timeline = new vis.Timeline(container, items, options);
  51. </script>
  52. </body>
  53. </html>