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.

52 lines
1.8 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Hiding periods</title>
  5. <style type="text/css">
  6. body, html {
  7. font-family: sans-serif;
  8. }
  9. </style>
  10. <script src="../../../dist/vis.js"></script>
  11. <link href="../../../dist/vis.css" rel="stylesheet" type="text/css"/>
  12. <script src="../../googleAnalytics.js"></script>
  13. </head>
  14. <body>
  15. <p>
  16. It's possible to hide (recurring) periods from the Timeline. The following example hides weekends and nights.
  17. </p>
  18. <div id="visualization"></div>
  19. <script type="text/javascript">
  20. // DOM element where the Timeline will be attached
  21. var container = document.getElementById('visualization');
  22. // Create a DataSet (allows two way data-binding)
  23. var items = new vis.DataSet([
  24. {id: 1, content: 'item 1', start: '2014-04-19'},
  25. {id: 2, content: 'item 2', start: '2014-04-21'},
  26. {id: 3, content: 'item 3', start: '2014-04-18'},
  27. {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-24'},
  28. {id: 5, content: 'item 5', start: '2014-04-26 12:00:00'},
  29. {id: 6, content: 'item 6', start: '2014-04-27', type: 'point'}
  30. ]);
  31. // Configuration for the Timeline
  32. var options = {
  33. hiddenDates: [
  34. {start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00'},
  35. {start: '2013-10-26 00:00:00', end: '2013-10-28 00:00:00', repeat: 'weekly'}, // daily weekly monthly yearly
  36. {start: '2013-03-29 20:00:00', end: '2013-03-30 09:00:00', repeat: 'daily'} // daily weekly monthly yearly
  37. ],
  38. start: '2014-04-17',
  39. end: '2014-05-01',
  40. height: '200px',
  41. editable: true
  42. };
  43. // Create a Timeline
  44. var timeline = new vis.Timeline(container, items, options);
  45. timeline.addCustomTime("2014-04-18 13:00:00");
  46. </script>
  47. </body>
  48. </html>