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.

31 lines
867 B

11 years ago
11 years ago
11 years ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title></title>
  5. <script src="../vis.js"></script>
  6. </head>
  7. <body>
  8. <script>
  9. var diffs = [
  10. 1000,
  11. 1000 * 60,
  12. 1000 * 60 * 60,
  13. 1000 * 60 * 60 * 24,
  14. 1000 * 60 * 60 * 24 * 30,
  15. 1000 * 60 * 60 * 24 * 30 * 100,
  16. 1000 * 60 * 60 * 24 * 30 * 10000
  17. ];
  18. diffs.forEach(function (diff) {
  19. var step = new vis.TimeStep(new Date(), new Date((new Date()).valueOf() + diff), diff / 40);
  20. console.log(diff, step._start.toLocaleString(), step._end.toLocaleString(), step.scale, step.step);
  21. step.first();
  22. while (step.hasNext()) {
  23. console.log(step.getLabelMajor(), ' --- ', step.getLabelMinor());
  24. step.next();
  25. }
  26. });
  27. </script>
  28. </body>
  29. </html>