non-numeric-y.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Line Chart</title>
  5. <script src="../../dist/Chart.bundle.js"></script>
  6. <script src="../utils.js"></script>
  7. <style>
  8. canvas{
  9. -moz-user-select: none;
  10. -webkit-user-select: none;
  11. -ms-user-select: none;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <div style="width:75%;">
  17. <canvas id="canvas"></canvas>
  18. </div>
  19. <script>
  20. var config = {
  21. type: 'line',
  22. data: {
  23. xLabels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
  24. yLabels: ['', 'Request Added', 'Request Viewed', 'Request Accepted', 'Request Solved', 'Solving Confirmed'],
  25. datasets: [{
  26. label: 'My First dataset',
  27. data: ['', 'Request Added', 'Request Added', 'Request Added', 'Request Viewed', 'Request Viewed', 'Request Viewed'],
  28. fill: false,
  29. borderColor: window.chartColors.red,
  30. backgroundColor: window.chartColors.red
  31. }]
  32. },
  33. options: {
  34. responsive: true,
  35. title: {
  36. display: true,
  37. text: 'Chart with Non Numeric Y Axis'
  38. },
  39. scales: {
  40. xAxes: [{
  41. display: true,
  42. scaleLabel: {
  43. display: true,
  44. labelString: 'Month'
  45. }
  46. }],
  47. yAxes: [{
  48. type: 'category',
  49. position: 'left',
  50. display: true,
  51. scaleLabel: {
  52. display: true,
  53. labelString: 'Request State'
  54. },
  55. ticks: {
  56. reverse: true
  57. }
  58. }]
  59. }
  60. }
  61. };
  62. window.onload = function() {
  63. var ctx = document.getElementById('canvas').getContext('2d');
  64. window.myLine = new Chart(ctx, config);
  65. };
  66. </script>
  67. </body>
  68. </html>