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.

50 lines
1.5 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Limit move and zoom</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. </head>
  14. <body>
  15. <p>
  16. The visible range is limited in this demo:
  17. </p>
  18. <ul>
  19. <li>minimum visible date is limited to 2012-01-01 using option <code>min</code></li>
  20. <li>maximum visible date is limited to 2013-01-01 (excluded) using option <code>max</code></li>
  21. <li>visible zoom interval is limited to a minimum of 24 hours using option <code>zoomMin</code></li>
  22. <li>visible zoom interval is limited to a maximum of about 3 months using option <code>zoomMax</code></li>
  23. </ul>
  24. <div id="visualization"></div>
  25. <script>
  26. // create some items
  27. var items = [
  28. {'start': new Date(2012, 4, 25), 'content': 'First'},
  29. {'start': new Date(2012, 4, 26), 'content': 'Last'}
  30. ];
  31. // create visualization
  32. var container = document.getElementById('visualization');
  33. var options = {
  34. height: '300px',
  35. min: new Date(2012, 0, 1), // lower limit of visible range
  36. max: new Date(2013, 0, 1), // upper limit of visible range
  37. zoomMin: 1000 * 60 * 60 * 24, // one day in milliseconds
  38. zoomMax: 1000 * 60 * 60 * 24 * 31 * 3 // about three months in milliseconds
  39. };
  40. // create the timeline
  41. var timeline = new vis.Timeline(container);
  42. timeline.setOptions(options);
  43. timeline.setItems(items);
  44. </script>
  45. </body>
  46. </html>