Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getData()
- {
- var d = document.getElementsByClassName('inputDateCell');
- var g = document.getElementsByClassName('inputGradeCell');
- var c = document.getElementsByClassName('col_4');
- var n = document.getElementsByClassName('col_0');
- var disp = Object.keys(c).length - Object.keys(g).length;
- var newData = [];
- var newCfu=[];
- var form = d3.time.format("%d/%m/%Y");
- for(var i=0; i<Object.keys(d).length-1; i++)
- {
- if(form.parse(d[i].value) !== null && g[i].value.length !== 0 )
- {
- newData.push({"data":d[i].value,"voto":g[i].value,"nome":n[i+disp].innerHTML});
- newCfu[i]=(parseInt(c[i+disp].innerHTML));
- }
- }
- update(newData,newCfu);
- }
- function update(d,c)
- {
- var svgCareer = d3.select("#starPath");
- svgCareer.remove();
- var newData = data.concat(d);
- drawStarPath('#careerStarPath',carStarWidth,carStarHeight,newData);
- var svgProgress = d3.select("#proDonut");
- svgProgress.remove();
- var newCfuNum = cfuTot+sum(c);
- var newProg = toFixed((newCfuNum/180)*100,2);
- drawDonutChart('#progressDonut',newProg,proWidth,proHeight,"#006699","#a3becc","proDonut");
- var g = [];
- for (var i=0; i < Object.keys(d).length; i++)
- g.push(parseInt(d[i].voto));
- var newGrade = grade.concat(g);
- var newCfu = cfu.concat(c);
- var newPond=toFixed(wmean(newGrade,newCfu),2);
- var newTitle=toFixed(tmean(newPond),2);
- document.getElementById("proCfuCell").innerHTML = "CFU: "+newCfuNum;
- document.getElementById("proMeanCell").innerHTML = "MEDIA: "+newPond;
- document.getElementById("proTitleCell").innerHTML = "TITOLO: "+newTitle;
- }
- function reset()
- {
- var svgCareer = d3.select("#starPath");
- svgCareer.remove();
- drawStarPath('#careerStarPath',carStarWidth,carStarHeight,data);
- var svgProgress = d3.select("#proDonut");
- svgProgress.remove();
- drawDonutChart('#progressDonut',progress,proWidth,proHeight,"#006699","#a3becc","proDonut");
- document.getElementById("proCfuCell").innerHTML = "";
- document.getElementById("proMeanCell").innerHTML = "";
- document.getElementById("proTitleCell").innerHTML = "";
- }
Advertisement
Add Comment
Please, Sign In to add comment