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.

56 lines
2.0 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Background areas with groups</title>
  5. <style>
  6. body, html {
  7. font-family: arial, sans-serif;
  8. font-size: 11pt;
  9. }
  10. </style>
  11. <script src="../../../dist/vis.js"></script>
  12. <link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  13. <script src="../../googleAnalytics.js"></script>
  14. </head>
  15. <body>
  16. <p>This example demonstrates the item type "background" when using groups.</p>
  17. <ul>
  18. <li>Background items having a group are displayed in that group</li>
  19. <li>Background items without a group are spread over the whole timeline</li>
  20. <li>Background items with a non-existing group are not displayed</li>
  21. </ul>
  22. <div id="visualization"></div>
  23. <script>
  24. var items = new vis.DataSet([
  25. {id: 'A', content: 'Period A', start: '2014-01-16', end: '2014-01-22', type: 'background', group: 1},
  26. {id: 'B', content: 'Period B', start: '2014-01-23', end: '2014-01-26', type: 'background', group: 2},
  27. {id: 'C', content: 'Period C', start: '2014-01-27', end: '2014-02-03', type: 'background'}, // no group
  28. {id: 'D', content: 'Period D', start: '2014-01-14', end: '2014-01-20', type: 'background', group: 'non-existing'},
  29. {id: 1, content: 'item 1<br>start', start: '2014-01-30', group: 1},
  30. {id: 2, content: 'item 2', start: '2014-01-18', group: 1},
  31. {id: 3, content: 'item 3', start: '2014-01-21', group: 2},
  32. {id: 4, content: 'item 4', start: '2014-01-17', end: '2014-01-21', group: 2},
  33. {id: 5, content: 'item 5', start: '2014-01-28', type:'point', group: 2},
  34. {id: 6, content: 'item 6', start: '2014-01-25', group: 2}
  35. ]);
  36. var groups = new vis.DataSet([
  37. {id: 1, content: 'Group 1'},
  38. {id: 2, content: 'Group 2'}
  39. ]);
  40. var container = document.getElementById('visualization');
  41. var options = {
  42. start: '2014-01-10',
  43. end: '2014-02-10',
  44. editable: true
  45. };
  46. var timeline = new vis.Timeline(container, items, groups, options);
  47. </script>
  48. </body>
  49. </html>