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.

62 lines
1.5 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. 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="../../dist/vis.js"></script>
  22. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  23. </head>
  24. <body>
  25. <div id="visualization"></div>
  26. <script>
  27. var now = moment().minutes(0).seconds(0).milliseconds(0);
  28. // create a dataset with items
  29. var items = new vis.DataSet({
  30. convert: {
  31. start: 'Date',
  32. end: 'Date'
  33. }
  34. });
  35. items.add([
  36. {id: 1, content: 'item 1<br>start', start: '2014-01-23'},
  37. {id: 2, content: 'item 2', start: '2014-01-18'},
  38. {id: 3, content: 'item 3', start: '2014-01-21'},
  39. {id: 4, content: 'item 4', start: '2014-01-19', end: '2014-01-24'},
  40. {id: 5, content: 'item 5', start: '2014-01-28', type:'point'},
  41. {id: 6, content: 'item 6', start: '2014-01-26'}
  42. ]);
  43. var container = document.getElementById('visualization');
  44. var options = {
  45. start: '2014-01-10',
  46. end: '2014-02-10',
  47. orientation: 'top',
  48. height: '100%',
  49. showCurrentTime: true
  50. };
  51. var timeline = new vis.Timeline(container, items, options);
  52. </script>
  53. </body>
  54. </html>