example18_limit_range.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <html>
  2. <head>
  3. <title>Timeline demo</title>
  4. <script type="text/javascript" src="../timeline.js"></script>
  5. <link rel="stylesheet" type="text/css" href="../timeline.css">
  6. <script type="text/javascript">
  7. var timeline;
  8. function drawVisualization() {
  9. // create and populate an array with data
  10. var data = [
  11. {'start': new Date(201, 4, 25), 'content': 'First'},
  12. {'start': new Date(2010, 4, 26), 'content': 'Last'}
  13. ];
  14. // specify options
  15. var options = {
  16. "width": "100%",
  17. "height": "300px",
  18. "min": new Date(2012, 0, 1), // lower limit of visible range
  19. "max": new Date(2012, 11, 31), // upper limit of visible range
  20. "intervalMin": 1000 * 60 * 60 * 24, // one day in milliseconds
  21. "intervalMax": 1000 * 60 * 60 * 24 * 31 * 3 // about three months in milliseconds
  22. };
  23. // Instantiate our timeline object.
  24. timeline = new links.Timeline(document.getElementById('mytimeline'));
  25. // Draw our timeline with the created data and options
  26. timeline.draw(data, options);
  27. }
  28. </script>
  29. </head>
  30. <body onload="drawVisualization();">
  31. <p>
  32. The visible range is limited in this demo:
  33. <ul>
  34. <li>minimum visible date is limited to 2012-01-01 using option <code>min</code></li>
  35. <li>maximum visible date is limited to 2012-12-31 using option <code>max</code></li>
  36. <li>visible interval is limited to a minimum of 24 hours using option <code>intervalMin</code></li>
  37. <li>visible interval is limited to a maximum of about 3 months using option <code>intervalMax</code></li>
  38. </ul>
  39. </p>
  40. <div id="mytimeline"></div>
  41. </body>
  42. </html>