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
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline demo</title>
  5. <script src="../timeline.js"></script>
  6. <link href="../timeline.css" rel="stylesheet" type="text/css" />
  7. <style>
  8. body, html {
  9. width: 100%;
  10. height: 100%;
  11. padding: 0;
  12. margin: 0;
  13. font-family: arial, sans-serif;
  14. font-size: 12pt;
  15. }
  16. #visualization {
  17. box-sizing: border-box;
  18. padding: 10px;
  19. width: 100%;
  20. height: 300px;
  21. }
  22. #visualization .itemset {
  23. /*background: rgba(255, 255, 0, 0.5);*/
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div id="visualization"></div>
  29. <script>
  30. // create a dataset with items
  31. var now = moment().minutes(0).seconds(0).milliseconds(0);
  32. var data = new DataSet({
  33. fieldTypes: {
  34. start: 'Date',
  35. end: 'Date'
  36. }
  37. });
  38. data.add([
  39. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4).toDate()},
  40. {id: 2, content: 'item 2', start: now.clone().add('days', -2).toDate() },
  41. {id: 3, content: 'item 3', start: now.clone().add('days', 2).toDate()},
  42. {id: 4, content: 'item 4', start: now.clone().add('days', 0).toDate(), end: now.clone().add('days', 3).toDate()},
  43. {id: 5, content: 'item 5', start: now.clone().add('days', 9).toDate(), type:'point'},
  44. {id: 6, content: 'item 6', start: now.clone().add('days', 11).toDate()}
  45. ]);
  46. var container = document.getElementById('visualization');
  47. var options = {
  48. start: now.clone().add('days', -3).valueOf(),
  49. end: now.clone().add('days', 7).valueOf()
  50. };
  51. var timeline = new Timeline(container, data, options);
  52. </script>
  53. </body>
  54. </html>