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.

111 lines
2.7 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | expected vs actual times items</title>
  5. <script src="../../../dist/vis.js"></script>
  6. <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" />
  7. <style>
  8. body, html {
  9. font-family: arial, sans-serif;
  10. font-size: 11pt;
  11. }
  12. .vis-item.expected {
  13. background-color: transparent;
  14. border-style: dashed!important;
  15. z-index: 0;
  16. }
  17. .vis-item.vis-selected {
  18. opacity: 0.6;
  19. }
  20. .vis-item.vis-background.marker {
  21. border-left: 2px solid green;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div id="visualization"></div>
  27. <script>
  28. // create a dataset with items
  29. // we specify the type of the fields `start` and `end` here to be strings
  30. // containing an ISO date. The fields will be outputted as ISO dates
  31. // automatically getting data from the DataSet via items.get().
  32. var items = new vis.DataSet({
  33. type: { start: 'ISODate', end: 'ISODate' }
  34. });
  35. var groups = new vis.DataSet([
  36. {
  37. id: 'group1',
  38. content:'group1'
  39. }
  40. ]);
  41. // add items to the DataSet
  42. items.add([
  43. // group 1
  44. {
  45. id: 'background1',
  46. start: '2014-01-21',
  47. end: '2014-01-22',
  48. type: 'background',
  49. group:'group1'
  50. },
  51. // subgroup 1
  52. {
  53. id: 1,
  54. content: 'item 1 (expected time)',
  55. className: 'expected',
  56. start: '2014-01-23T12:00:00',
  57. end: '2014-01-26T12:00:00',
  58. group:'group1',
  59. subgroup:'sg_1'
  60. },
  61. {
  62. id: 2,
  63. content: 'item 1 (actual time)',
  64. start: '2014-01-24T12:00:00',
  65. end: '2014-01-27T12:00:00',
  66. group:'group1',
  67. subgroup:'sg_1'
  68. },
  69. // subgroup 2
  70. {
  71. id: 3,
  72. content: 'item 2 (expected time)',
  73. className: 'expected',
  74. start: '2014-01-13T12:00:00',
  75. end: '2014-01-16T12:00:00',
  76. group:'group1',
  77. subgroup:'sg_2'
  78. },
  79. {
  80. id: 4,
  81. content: 'item 2 (actual time)',
  82. start: '2014-01-14T12:00:00',
  83. end: '2014-01-17T12:00:00',
  84. group:'group1',
  85. subgroup:'sg_2'
  86. }
  87. ]);
  88. var container = document.getElementById('visualization');
  89. var options = {
  90. start: '2014-01-10',
  91. end: '2014-02-10',
  92. editable: true,
  93. stack: false,
  94. stackSubgroups: false
  95. };
  96. var timeline = new vis.Timeline(container, items, groups, options);
  97. </script>
  98. </body>
  99. </html>