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.

55 lines
2.3 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.css" rel="stylesheet" type="text/css" />
  13. <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head>
  14. <body>
  15. <p>This example demonstrates the item type "background" when using groups.</p>
  16. <ul>
  17. <li>Background items having a group are displayed in that group</li>
  18. <li>Background items without a group are spread over the whole timeline</li>
  19. <li>Background items with a non-existing group are not displayed</li>
  20. </ul>
  21. <div id="visualization"></div>
  22. <script>
  23. var items = new vis.DataSet([
  24. {id: 'A', content: 'Period A', start: '2014-01-16', end: '2014-01-22', type: 'background', group: 1},
  25. {id: 'B', content: 'Period B', start: '2014-01-23', end: '2014-01-26', type: 'background', group: 2},
  26. {id: 'C', content: 'Period C', start: '2014-01-27', end: '2014-02-03', type: 'background'}, // no group
  27. {id: 'D', content: 'Period D', start: '2014-01-14', end: '2014-01-20', type: 'background', group: 'non-existing'},
  28. {id: 1, content: 'item 1<br>start', start: '2014-01-30', group: 1},
  29. {id: 2, content: 'item 2', start: '2014-01-18', group: 1},
  30. {id: 3, content: 'item 3', start: '2014-01-21', group: 2},
  31. {id: 4, content: 'item 4', start: '2014-01-17', end: '2014-01-21', group: 2},
  32. {id: 5, content: 'item 5', start: '2014-01-28', type:'point', group: 2},
  33. {id: 6, content: 'item 6', start: '2014-01-25', group: 2}
  34. ]);
  35. var groups = new vis.DataSet([
  36. {id: 1, content: 'Group 1'},
  37. {id: 2, content: 'Group 2'}
  38. ]);
  39. var container = document.getElementById('visualization');
  40. var options = {
  41. start: '2014-01-10',
  42. end: '2014-02-10',
  43. editable: true
  44. };
  45. var timeline = new vis.Timeline(container, items, groups, options);
  46. </script>
  47. </body>
  48. </html>