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.

55 lines
1.5 KiB

11 years ago
11 years ago
11 years ago
11 years ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline demo</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. #visualization .itemset {
  16. /*background: rgba(255, 255, 0, 0.5);*/
  17. }
  18. </style>
  19. <script src="../../vis.js"></script>
  20. </head>
  21. <body>
  22. <div id="visualization"></div>
  23. <script>
  24. // create a dataset with items
  25. var now = moment().minutes(0).seconds(0).milliseconds(0);
  26. var data = new vis.DataSet({
  27. fieldTypes: {
  28. start: 'Date',
  29. end: 'Date'
  30. }
  31. });
  32. data.add([
  33. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4).toDate()},
  34. {id: 2, content: 'item 2', start: now.clone().add('days', -2).toDate() },
  35. {id: 3, content: 'item 3', start: now.clone().add('days', 2).toDate()},
  36. {id: 4, content: 'item 4', start: now.clone().add('days', 0).toDate(), end: now.clone().add('days', 3).toDate()},
  37. {id: 5, content: 'item 5', start: now.clone().add('days', 9).toDate(), type:'point'},
  38. {id: 6, content: 'item 6', start: now.clone().add('days', 11).toDate()}
  39. ]);
  40. var container = document.getElementById('visualization');
  41. var options = {
  42. start: now.clone().add('days', -3).valueOf(),
  43. end: now.clone().add('days', 7).valueOf()
  44. };
  45. var timeline = new vis.Timeline(container, data, options);
  46. </script>
  47. </body>
  48. </html>