-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
1 lines (1 loc) · 3.34 KB
/
app.js
1
var ctx=document.getElementById("myPie"),myChart=new Chart(ctx,{type:"line",data:{labels:["Dimanche","Lundi","Mardi","Mercredi","Jeudi"],datasets:[{label:"Nombre de presences 2CP",data:[185,176,167,194,164],backgroundColor:["rgba(54, 162, 235, 0.2)"],borderColor:["rgba(54, 162, 235, 1)"],borderWidth:2},{label:"Nombre de presences 1CP",data:[183,127,111,161,155],backgroundColor:["rgba(54, 162, 235, 0.2)","rgba(27, 191, 50, 0.2)"],borderColor:["rgba(54, 162, 235, 1)","rgba(27, 191, 50, 1)"],borderWidth:2}]},options:{scales:{y:{suggestedMin:60}}}}),ctx2=document.getElementById("mypie1cp"),myChart2=new Chart(ctx2,{type:"pie",data:{labels:["Présents","Absents"],datasets:[{label:"# of Votes",data:[183,78],backgroundColor:["rgba(54, 162, 235, 0.2)","rgba(255, 99, 132, 0.2)"],borderColor:["rgba(54, 162, 235, 1)","rgba(255, 99, 132, 1)"],borderWidth:1}]},options:{}}),ctx3=document.getElementById("mypie2cp"),myChart3=new Chart(ctx3,{type:"pie",data:{labels:["Présents","Absents"],datasets:[{label:"# of Votes",data:[185,36],backgroundColor:["rgba(54, 162, 235, 0.2)","rgba(255, 99, 132, 0.2)"],borderColor:["rgba(54, 162, 235, 1)","rgba(255, 99, 132, 1)"],borderWidth:1}]},options:{}});document.getElementById("dim1cp").addEventListener("click",function(){document.getElementById("buttonday1").innerHTML="Dimanche",myChart2.data.datasets[0].data[0]=183,myChart2.data.datasets[0].data[1]=78,myChart2.update()}),document.getElementById("lun1cp").addEventListener("click",function(){document.getElementById("buttonday1").innerHTML="Lundi",myChart2.data.datasets[0].data[0]=127,myChart2.data.datasets[0].data[1]=134,myChart2.update()}),document.getElementById("mar1cp").addEventListener("click",function(){document.getElementById("buttonday1").innerHTML="Mardi",myChart2.data.datasets[0].data[0]=111,myChart2.data.datasets[0].data[1]=150,myChart2.update()}),document.getElementById("mer1cp").addEventListener("click",function(){document.getElementById("buttonday1").innerHTML="Mercredi",myChart2.data.datasets[0].data[0]=161,myChart2.data.datasets[0].data[1]=100,myChart2.update()}),document.getElementById("jeu1cp").addEventListener("click",function(){document.getElementById("buttonday1").innerHTML="Jeudi",myChart2.data.datasets[0].data[0]=155,myChart2.data.datasets[0].data[1]=106,myChart2.update()}),document.getElementById("dim2cp").addEventListener("click",function(){document.getElementById("buttonday2").innerHTML="Dimanche",myChart3.data.datasets[0].data[0]=185,myChart3.data.datasets[0].data[1]=36,myChart3.update()}),document.getElementById("lun2cp").addEventListener("click",function(){document.getElementById("buttonday2").innerHTML="Lundi",myChart3.data.datasets[0].data[0]=176,myChart3.data.datasets[0].data[1]=45,myChart3.update()}),document.getElementById("mar2cp").addEventListener("click",function(){document.getElementById("buttonday2").innerHTML="Mardi",myChart3.data.datasets[0].data[0]=167,myChart3.data.datasets[0].data[1]=54,myChart3.update()}),document.getElementById("mer2cp").addEventListener("click",function(){document.getElementById("buttonday2").innerHTML="Mercredi",myChart3.data.datasets[0].data[0]=194,myChart3.data.datasets[0].data[1]=27,myChart3.update()}),document.getElementById("jeu2cp").addEventListener("click",function(){document.getElementById("buttonday2").innerHTML="Jeudi",myChart3.data.datasets[0].data[0]=164,myChart3.data.datasets[0].data[1]=57,myChart3.update()});