mixChart.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var labels = [
  2. "Mardi",
  3. "Mercredi",
  4. "Jeudi",
  5. "Vendredi",
  6. "Samedi"
  7. ];
  8. var frequentations = [
  9. 12,
  10. 15,
  11. 18,
  12. 19,
  13. 22
  14. ];
  15. var moyennes = [
  16. 17,
  17. 19,
  18. 18,
  19. 26,
  20. 31
  21. ];
  22. var mix = document.getElementById("mixChart").getContext('2d');
  23. var mixChart = new Chart(mix, {
  24. type: 'bar',
  25. data: {
  26. labels: labels,
  27. datasets: [
  28. {
  29. type: 'line',
  30. label: "Moyenne mensuelle",
  31. data: moyennes,
  32. borderColor: 'rgba(75, 192, 192, 1)',
  33. backgroundColor: 'rgba(0, 0, 0, 0)',
  34. yAxisID: 'frequentations',
  35. },
  36. {
  37. label: "Cette semaine",
  38. data: frequentations,
  39. borderColor: 'rgba(0, 0, 0, 0)',
  40. backgroundColor: 'rgba(192, 75, 192, 0.5)',
  41. yAxisID: 'frequentations',
  42. }
  43. ]
  44. },
  45. options: {
  46. scales: {
  47. yAxes: [
  48. {
  49. id: "frequentations",
  50. ticks: {
  51. beginAtZero: true,
  52. },
  53. scaleLabel: {
  54. display: true,
  55. labelString: 'Frequentation '
  56. }
  57. },
  58. ]
  59. },
  60. }
  61. });