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.

51 lines
1.6 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. // note that months are zero-based in the JavaScript Date object, so month 4 is May
  28. var items = [
  29. {'start': new Date(2012, 4, 25), 'content': 'First'},
  30. {'start': new Date(2012, 4, 26), 'content': 'Last'}
  31. ];
  32. // create visualization
  33. var container = document.getElementById('visualization');
  34. var options = {
  35. height: '300px',
  36. min: new Date(2012, 0, 1), // lower limit of visible range
  37. max: new Date(2013, 0, 1), // upper limit of visible range
  38. zoomMin: 1000 * 60 * 60 * 24, // one day in milliseconds
  39. zoomMax: 1000 * 60 * 60 * 24 * 31 * 3 // about three months in milliseconds
  40. };
  41. // create the timeline
  42. var timeline = new vis.Timeline(container);
  43. timeline.setOptions(options);
  44. timeline.setItems(items);
  45. </script>
  46. </body>
  47. </html>