mixChart.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var labels = [
  2. "sunday",
  3. "monday",
  4. "tuesday",
  5. "wednesday",
  6. "thursday",
  7. "friday",
  8. "saturday"
  9. ];
  10. var frequentations = [
  11. 20,
  12. 14,
  13. 12,
  14. 15,
  15. 18,
  16. 19,
  17. 22
  18. ];
  19. var moyennes = [
  20. 15,
  21. 17,
  22. 17,
  23. 19,
  24. 18,
  25. 26,
  26. 31
  27. ];
  28. var mix = document.getElementById("mixChart").getContext('2d');
  29. var mixChart = new Chart(mix, {
  30. type: 'bar',
  31. data: {
  32. labels: labels,
  33. datasets: [
  34. {
  35. type: 'line',
  36. label: "monthly average",
  37. data: moyennes,
  38. borderColor: 'rgba(75, 192, 192, 1)',
  39. backgroundColor: 'rgba(0, 0, 0, 0)',
  40. yAxisID: 'frequentations',
  41. },
  42. {
  43. label: "This week",
  44. data: frequentations,
  45. borderColor: 'rgba(0, 0, 0, 0)',
  46. backgroundColor: 'rgba(192, 75, 192, 0.5)',
  47. yAxisID: 'frequentations',
  48. }
  49. ]
  50. },
  51. options: {
  52. scales: {
  53. yAxes: [
  54. {
  55. id: "frequentations",
  56. ticks: {
  57. beginAtZero: true,
  58. },
  59. scaleLabel: {
  60. display: true,
  61. labelString: 'Frequentation '
  62. }
  63. },
  64. ]
  65. },
  66. }
  67. });