timestamps.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!doctype html>
  2. <head>
  3. <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  4. <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
  5. <script src="../morris.js"></script>
  6. <script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.js"></script>
  7. <script src="lib/example.js"></script>
  8. <link rel="stylesheet" href="lib/example.css">
  9. <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
  10. <link rel="stylesheet" href="../morris.css">
  11. </head>
  12. <body>
  13. <h1>Timestamps</h1>
  14. <div id="graph"></div>
  15. <pre id="code" class="prettyprint linenums">
  16. /* data stolen from http://howmanyleft.co.uk/vehicle/jaguar_'e'_type */
  17. var timestamp_data = [
  18. {"period": 1349046000000, "licensed": 3407, "sorned": 660},
  19. {"period": 1313103600000, "licensed": 3351, "sorned": 629},
  20. {"period": 1299110400000, "licensed": 3269, "sorned": 618},
  21. {"period": 1281222000000, "licensed": 3246, "sorned": 661},
  22. {"period": 1273446000000, "licensed": 3257, "sorned": 667},
  23. {"period": 1268524800000, "licensed": 3248, "sorned": 627},
  24. {"period": 1263081600000, "licensed": 3171, "sorned": 660},
  25. {"period": 1260403200000, "licensed": 3171, "sorned": 676},
  26. {"period": 1254870000000, "licensed": 3201, "sorned": 656},
  27. {"period": 1253833200000, "licensed": 3215, "sorned": 622}
  28. ];
  29. Morris.Line({
  30. element: 'graph',
  31. data: timestamp_data,
  32. xkey: 'period',
  33. ykeys: ['licensed', 'sorned'],
  34. labels: ['Licensed', 'SORN'],
  35. dateFormat: function (x) { return new Date(x).toDateString(); }
  36. });
  37. </pre>
  38. </body>