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
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline demo</title>
  5. <script src="../../vis.js"></script>
  6. <style>
  7. body, html {
  8. font-family: arial, sans-serif;
  9. font-size: 12pt;
  10. }
  11. #visualization {
  12. box-sizing: border-box;
  13. width: 100%;
  14. height: 300px;
  15. }
  16. #visualization .itemset {
  17. /*background: rgba(255, 255, 0, 0.5);*/
  18. }
  19. </style>
  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 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 Timeline(container, data, options);
  46. </script>
  47. </body>
  48. </html>