diagonal-xlabels-bar.html 1.5 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>Displaying X Labels Diagonally (Bar Chart)</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 day_data = [
  18. {"period": "2012-10-01", "licensed": 3407, "sorned": 660},
  19. {"period": "2012-09-30", "licensed": 3351, "sorned": 629},
  20. {"period": "2012-09-29", "licensed": 3269, "sorned": 618},
  21. {"period": "2012-09-20", "licensed": 3246, "sorned": 661},
  22. {"period": "2012-09-19", "licensed": 3257, "sorned": 667},
  23. {"period": "2012-09-18", "licensed": 3248, "sorned": 627},
  24. {"period": "2012-09-17", "licensed": 3171, "sorned": 660},
  25. {"period": "2012-09-16", "licensed": 3171, "sorned": 676},
  26. {"period": "2012-09-15", "licensed": 3201, "sorned": 656},
  27. {"period": "2012-09-10", "licensed": 3215, "sorned": 622}
  28. ];
  29. Morris.Bar({
  30. element: 'graph',
  31. data: day_data,
  32. xkey: 'period',
  33. ykeys: ['licensed', 'sorned'],
  34. labels: ['Licensed', 'SORN'],
  35. xLabelAngle: 60
  36. });
  37. </pre>
  38. </body>