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.

102 lines
3.6 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
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></title>
  5. <script>
  6. function require() {}
  7. var module = {
  8. exports: {}
  9. };
  10. var exports = module.exports;
  11. </script>
  12. <script src="../lib/moment.min.js"></script>
  13. <script src="../src/module.js"></script>
  14. <script src="../src/util.js"></script>
  15. <script src="../src/events.js"></script>
  16. <script src="../src/timestep.js"></script>
  17. <script src="../src/dataset.js"></script>
  18. <script src="../src/stack.js"></script>
  19. <script src="../src/controller.js"></script>
  20. <script src="../src/range.js"></script>
  21. <script src="../src/component/component.js"></script>
  22. <script src="../src/component/panel.js"></script>
  23. <script src="../src/component/rootpanel.js"></script>
  24. <script src="../src/component/timeaxis.js"></script>
  25. <script src="../src/component/itemset.js"></script>
  26. <script src="../src/component/item/item.js"></script>
  27. <script src="../src/component/item/itembox.js"></script>
  28. <script src="../src/component/item/itemrange.js"></script>
  29. <script src="../src/component/item/itempoint.js"></script>
  30. <script src="../src/visualization/timeline.js"></script>
  31. <link href="../src/component/css/panel.css" rel="stylesheet" type="text/css" />
  32. <link href="../src/component/css/timeaxis.css" rel="stylesheet" type="text/css" />
  33. <link href="../src/component/css/item.css" rel="stylesheet" type="text/css" />
  34. <style type="text/css">
  35. body, html {
  36. font-family: sans-serif;
  37. font-size: 12pt;
  38. }
  39. #visualization .itemset {
  40. /*background: rgba(255, 255, 0, 0.5);*/
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div>
  46. <label for="orientation">Orientation</label>
  47. <select id="orientation">
  48. <option value="top">top</option>
  49. <option value="bottom" selected>bottom</option>
  50. </select>
  51. </div>
  52. <script>
  53. var orientation = document.getElementById('orientation');
  54. orientation.onchange = function () {
  55. timeline.setOptions({
  56. orientation: orientation.value
  57. });
  58. };
  59. </script>
  60. <br>
  61. <div id="visualization"></div>
  62. <script>
  63. // create a dataset with items
  64. var now = moment().minutes(0).seconds(0).milliseconds(0);
  65. var data = new vis.DataSet({
  66. fieldTypes: {
  67. start: 'Date',
  68. end: 'Date'
  69. }
  70. });
  71. data.add([
  72. {id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4).toDate()},
  73. {id: 2, content: 'item 2', start: now.clone().add('days', -2).toDate() },
  74. {id: 3, content: 'item 3', start: now.clone().add('days', 2).toDate()},
  75. {id: 4, content: 'item 4',
  76. start: now.clone().add('days', 0).toDate(),
  77. end: now.clone().add('days', 7).toDate()},
  78. {id: 5, content: 'item 5', start: now.clone().add('days', 9).toDate(), type:'point'},
  79. {id: 6, content: 'item 6', start: now.clone().add('days', 11).toDate()}
  80. ]);
  81. var container = document.getElementById('visualization');
  82. var options = {
  83. //start: now.clone().add('days', -7).valueOf(),
  84. //end: now.clone().add('days', 7).valueOf(),
  85. min: moment('2013-01-01').valueOf(),
  86. max: moment('2013-12-31').valueOf(),
  87. zoomMin: 1000 * 60 * 60 * 24, // 1 day
  88. zoomMax: 1000 * 60 * 60 * 24 * 30 * 6 // 6 months
  89. };
  90. var timeline = new vis.Timeline(container, data, options);
  91. </script>
  92. </body>
  93. </html>