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.

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