diff --git a/2024/js/topGPA.js b/2024/js/topGPA.js new file mode 100644 index 0000000..2b062bf --- /dev/null +++ b/2024/js/topGPA.js @@ -0,0 +1,119 @@ +var topGPA = { + countGPA : function(rankid,gpaid,fieldid,N){ + + console.log(rankid); + console.log(gpaid); + console.log(fieldid); + + var fields = Object.keys(fullAllocation); + currentAllocation = {'Chem':0,'Civil':0,'Comp':0,'Elect':0,'Mech':0,'Manufac':0}; + + //iterate throught all the elements upto N + for(var i=1;i<=N;i++){ + //console.log(i); + //Get the current line from the dataArray + var singleData = dataArray[i]; + + //add to the current Allocation + var currentField = singleData[fieldid]; + currentAllocation[currentField] = currentAllocation[currentField]+1; + + } + console.dir(currentAllocation); + + //making the series object + + var series = []; + var keys = Object.keys(currentAllocation); + for(i=0;i=data){ + count = count+1; + }else{ + break; + } + } + + console.log("GPA greater than "+data+ " is "+count); + + topGPA.countGPA(rankid,gpaid,fieldid,count); + + + }, + drawGraph : function(series){ + $(function () { + Highcharts.chart('graphContainer', { + chart: { + type: 'column' + }, + title: { + text: 'Allocation of Top Students Based on GPA' + }, + subtitle: { + text: 'Total Number of students allocated for each field and the percentage of maximum allocation' + }, + xAxis: { + categories: [ + 'Number of Students assigned for the field','Number of Students / Maximum Allocation' + ], + crosshair: true + }, + yAxis: { + min: 0, + title: { + text: 'Students' + } + }, + + plotOptions: { + column: { + pointPadding: 0.2, + borderWidth: 0 + },tooltip: { + headerFormat: '{point.key}', + pointFormat: '' + + '', + footerFormat: '
{series.name}: {point.y.toFixed(2)} mm
', + shared: true, + useHTML: true + } + }, + series: series + }); + }); + } + + + +};