From 9272459c9f5ff768c5e48cffb0ae02f5e4000e4b Mon Sep 17 00:00:00 2001 From: Monique Date: Thu, 9 Dec 2021 16:47:36 +0100 Subject: [PATCH] 2 varianten grafiek met variabele yas --- application/views/monpas/mainheader.php | 2 + .../views/monpas/pages/mondiv/diversiteit.php | 27 +- .../monpas/models/mondiv/diversiteitsmodel.js | 264 +++++++++++++----- 3 files changed, 216 insertions(+), 77 deletions(-) diff --git a/application/views/monpas/mainheader.php b/application/views/monpas/mainheader.php index c6e63b6..07991f7 100644 --- a/application/views/monpas/mainheader.php +++ b/application/views/monpas/mainheader.php @@ -21,6 +21,8 @@ + + diff --git a/application/views/monpas/pages/mondiv/diversiteit.php b/application/views/monpas/pages/mondiv/diversiteit.php index f746a08..664c698 100644 --- a/application/views/monpas/pages/mondiv/diversiteit.php +++ b/application/views/monpas/pages/mondiv/diversiteit.php @@ -2,8 +2,8 @@
Er zijn (nog) geen groepsgegevens ingevoerd.
-
-

Diversiteitomvang +
+

Diversiteitomvang

@@ -136,16 +136,21 @@

Groep 1-2:

Groep 3-8:


-

Diversiteitsquotiënt per groep - -

-
+
+
+
+ +
+
+
- - -
-

Groep

-
+
+
+
+ +
+
+

Leerlingaantallen diff --git a/public/js/monpas/models/mondiv/diversiteitsmodel.js b/public/js/monpas/models/mondiv/diversiteitsmodel.js index f849103..9dd3557 100644 --- a/public/js/monpas/models/mondiv/diversiteitsmodel.js +++ b/public/js/monpas/models/mondiv/diversiteitsmodel.js @@ -195,8 +195,11 @@ ls.initDiversiteitModel = function(module){ // } - self.schooldiversiteit(self.schooldiversiteit() + parseFloat(p.som1) + (parseFloat(p.som2) *1.5) + (parseFloat(p.som3) * 2) + (parseFloat(p.som4) *4) + parseFloat(combiwaarde)); + self.schooldiversiteit(self.schooldiversiteit() + parseFloat(p.som1) + (parseFloat(p.som2) *1.5) + (parseFloat(p.som3) * 2) + (parseFloat(p.som4) *4)); + if(Number(self.schooldiversiteit() > 0 && combiwaarde > 0)) { + self.schooldiversiteit(self.schooldiversiteit + combiwaarde)} + self.schoolTijd (parseInt(self.schoolTijd()) + parseInt(p.tottijdInt())); gewogensom = gewogensom + parseInt(p.factor); if (p.tijden){ @@ -211,8 +214,15 @@ ls.initDiversiteitModel = function(module){ }; // if p.tijden }); // each + if(Number(self.schooldiversiteit()=== 0)) { + apprise('geen ondersteuning gevonden'); + return; + } + self.schoolDQ(Math.round((self.schooldiversiteit() / gewogensom) * 100 ) / 100); + + var minuten = self.schoolTijd() % 60; var uur = (self.schoolTijd() - minuten) / 60; @@ -249,85 +259,207 @@ ls.initDiversiteitModel = function(module){ }; // if data self.fFillGraph(); + },'json'); }; // if data },'json'); },'json'); // get aantallen }, - fFillGraph: function(){ + + + fFillGraph(){ var self = ls.DiversiteitModel; - var scores =[]; - var slabels =[]; + var scores= []; + var labels = []; var counter = 0; - // var aantalgroepen = self.groepen().length + 1; - // var bartussenruimte = (580 - (80 * aantalgroepen))/aantalgroepen ; - // if (bartussenruimte <=0 ) bartussenruimte = 4; - bartussenruimte = 5; - - $.each(self.groepen(), function(i,p){ - scores[i] = p.DQ; - slabels[i] = p.naam; - counter = counter + 1; + $.each(self.groepen(), function(i,p){ + scores[i] = p.DQ === 0 ? null : Number(p.DQ ); + labels[i] = p.naam; + counter = counter + 1; + }); + labels[counter]='school'; + scores[counter]= self.schoolDQ() === 0? null: Number(self.schoolDQ()); + + + Highcharts.chart('dqpergroep', { + chart: { + type: 'column', + backgroundColor: '#ffffff', + + }, + title: { + text: 'Diversiteitsquotiënt per groep' + }, + credits:{ + enabled: false + }, + xAxis: { + categories: labels, + + }, + yAxis: { + min: 0, + tickInterval: 0.2, + title: { + text: 'DQ' + } + }, + tooltip: { + headerFormat: 'groep: {point.key}

', + pointFormat: '' + + '', + footerFormat: '
{series.name}: {point.y:.1f}
', + shared: true, + useHTML: true + }, + legend: { + enabled: false, + }, + + series: [{ + name: 'dq', + color: '#6F0B3D', + data: scores + + }], + plotOptions: { + series: { + pointWidth: null, + pointPadding: 0, + } + }, }); - slabels[counter]='school'; - scores[counter]=self.schoolDQ(); - if (self.BC6 ) {self.BC6.destroy(); } - - $("#cdiversiteit").remove(); - - var canv = document.createElement('canvas'); - canv.id = 'cdiversiteit'; - canv.width = 580; - canv.height = 285; - document.getElementById('diversiteitcanvasholder').appendChild(canv); - - var ctxDiversiteit=$("#cdiversiteit").get(0).getContext("2d"); - - var data6 = {labels :slabels, - datasets: [{fillColor: "rgba(147,15,80,0.9)", - strokeColor: "rgba(111,11,61,1)", - highlightStroke: "rgba(222,22,123,1)", - data: scores}, - ]} + Highcharts.chart('dqpergroep3d', { + chart: { + type: 'column', + backgroundColor: '#ffffff', + options3d: { + enabled: true, + alpha: 15, + beta: 15, + depth: 50, + viewDistance: 25 + } - Chart.types.Bar.extend({ - name: "LineAlt", - initialize: function () { + }, + title: { + text: 'Diversiteitsquotiënt per groep' + }, + credits:{ + enabled: false + }, + xAxis: { + categories: labels, - Chart.types.Bar.prototype.initialize.apply(this, arguments); - }, - draw: function () { + }, + yAxis: { + min: 0, + tickInterval: 0.2, + title: { + text: 'DQ' + } + }, + tooltip: { + headerFormat: 'groep: {point.key}', + pointFormat: '' + + '', + footerFormat: '
{series.name}: {point.y:.1f}
', + shared: true, + useHTML: true + }, + legend: { + enabled: false, + }, - Chart.types.Bar.prototype.draw.apply(this, arguments); - // this.chart.ctx.beginPath(); - // this.chart.ctx.moveTo(30,137); - // this.chart.ctx.lineTo(580, 137); - // this.chart.ctx.stroke(); - // this.chart.ctx.closePath(); - } + series: [{ + name: 'dq', + color: '#6F0B3D', + data: scores + + }], + plotOptions: { + series: { + pointWidth: null, + pointPadding: 0, + } + }, }); - - self.BC6 = new Chart(ctxDiversiteit).LineAlt(data6,{ - animation:false, - scaleFontFamily: "'lato','Arial'", - scaleColor:"rgba(0,0,0,1)", - scaleShowGridLines:true, - scaleLineColor:"rgba(0,0,0,1)", - scaleOverride: true, - scaleBeginAtZero :true, - scaleSteps: 25, - scaleStepWidth: 0.2, - scaleStartValue: 0 , - barValueSpacing: bartussenruimte, - barStrokeWidth:1, - barDatasetSpacing:2, - toottipFontFamily:"'lato','Arial'", - showTooltips : true, - tooltipTemplate: "<%= label %> : <%= value %>" - }); + }, - }, + // fFillGraph: function(){ + // var self = ls.DiversiteitModel; + // var scores =[]; + // var slabels =[]; + // var counter = 0; + // // var aantalgroepen = self.groepen().length + 1; + // // var bartussenruimte = (580 - (80 * aantalgroepen))/aantalgroepen ; + // // if (bartussenruimte <=0 ) bartussenruimte = 4; + // bartussenruimte = 5; + // + // $.each(self.groepen(), function(i,p){ + // scores[i] = p.DQ; + // slabels[i] = p.naam; + // counter = counter + 1; + // }); + // slabels[counter]='school'; + // scores[counter]=self.schoolDQ(); + // if (self.BC6 ) {self.BC6.destroy(); } + // + // $("#cdiversiteit").remove(); + // + // var canv = document.createElement('canvas'); + // canv.id = 'cdiversiteit'; + // canv.width = 580; + // canv.height = 285; + // document.getElementById('diversiteitcanvasholder').appendChild(canv); + // + // var ctxDiversiteit=$("#cdiversiteit").get(0).getContext("2d"); + // + // var data6 = {labels :slabels, + // datasets: [{fillColor: "rgba(147,15,80,0.9)", + // strokeColor: "rgba(111,11,61,1)", + // highlightStroke: "rgba(222,22,123,1)", + // data: scores}, + // ]} + // + // Chart.types.Bar.extend({ + // name: "LineAlt", + // initialize: function () { + // + // Chart.types.Bar.prototype.initialize.apply(this, arguments); + // }, + // draw: function () { + // + // Chart.types.Bar.prototype.draw.apply(this, arguments); + // // this.chart.ctx.beginPath(); + // // this.chart.ctx.moveTo(30,137); + // // this.chart.ctx.lineTo(580, 137); + // // this.chart.ctx.stroke(); + // // this.chart.ctx.closePath(); + // } + // }); + // + // self.BC6 = new Chart(ctxDiversiteit).LineAlt(data6,{ + // animation:false, + // scaleFontFamily: "'lato','Arial'", + // scaleColor:"rgba(0,0,0,1)", + // scaleShowGridLines:true, + // scaleLineColor:"rgba(0,0,0,1)", + // scaleOverride: true, + // scaleBeginAtZero :true, + // scaleSteps: 25, + // scaleStepWidth: 0.2, + // scaleStartValue: 0 , + // barValueSpacing: bartussenruimte, + // barStrokeWidth:1, + // barDatasetSpacing:2, + // toottipFontFamily:"'lato','Arial'", + // showTooltips : true, + // tooltipTemplate: "<%= label %> : <%= value %>" + // }); + // + // }, fPrintDiversiteitBar :function(){ var self = ls.DiversiteitModel;