var data0=[],data1=[],data2=[],data3=[]; var startDate,endDate; var studentid; var data_temp,_index=0; function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } function getData(startDate,endDate){ var attend = "" ; if(startDate != null && endDate != null){ attend = "&start_Date="+startDate+"&end_Date="+endDate; } $.ajax({ url:URL+ attend, type:"get", async:false, dataType:"json", success:function(data){ data_temp=data; console.log(data); var _html=''; for(var i=0;i'; if(studentid==data.data.studentList[i].ID) _index=i; } $(".content_l ul").html(_html); console.log(_index); } }); data(_index,data_temp); $(".content_l li").eq(_index).siblings().removeClass("on"); $(".content_l li").eq(_index).addClass("on"); } $( document ).ready(function() { //alert($("input[type=radio][checked]").val()); studentid=getQueryString("studentid"); getData(); //$('#myStathalf').circliful(); //$('#myStathalf1').circliful(); $(document).on("click",".content_l li",function(){ $(this).siblings().removeClass("on"); $(this).addClass("on"); _index=$(this).index(); data(_index,data_temp); studentid = 0; }) $("input[type=radio]").change(function(){ //alert($("input[type='radio']:checked").val()); data(_index,data_temp); }) $("#search").click(function(){ var date_string=$("#test6").val(); var date_arry=date_string.split(' - '); startDate=date_arry[0]; endDate=date_arry[1]; getData(startDate,endDate); }) }); function data(index,data){ console.log(data); var GETSCORE = parseInt(data.data.studentList[index].GETSCORE); var TOTALSCORE = parseInt(data.data.TOTAL_SCORE); var ratio=(GETSCORE/TOTALSCORE*100).toFixed(2); var class_avg= (parseInt(data.data.AVG_SCORE)/ parseInt(data.data.TOTAL_SCORE)*100).toFixed(2); var class_max=(parseInt(data.data.MAX_SCORE)/ parseInt(data.data.TOTAL_SCORE)*100).toFixed(2); var test_num=data.data.studentList[index].testList.length; var part_num=test_num; //console.log(data.data.studentList[index].testList[2].SCORE); if($("input[type='radio']:checked").val()==1){ for(var i=0;i0){ data0[i]=data.data.studentList[index].testList[i].NAME; data1[i]=(data.data.studentList[index].testList[i].AVG_SCORE/data.data.studentList[index].testList[i].TOTAL_SCORE*100).toFixed(2); data2[i]=(data.data.studentList[index].testList[i].SCORE/data.data.studentList[index].testList[i].TOTAL_SCORE*100).toFixed(2); data3[i]=(data.data.studentList[index].testList[i].MAX_SCORE/data.data.studentList[index].testList[i].TOTAL_SCORE*100).toFixed(2); }else{ data1[i]=0; data2[i]=0; data3[i]=0; } if(data.data.studentList[index].testList[i].SCORE=="0") part_num--; } }else if($("input[type='radio']:checked").val()==2){ for(var i=0;i'); $(".circle .col-md-6").eq(0).html('
'); $('#myStathalf1').circliful(); $('#myStathalf').circliful(); myChart.setOption(option); } var myChart = echarts.init(document.getElementById('main')); var option = { xAxis: { type: 'category', data: data0 }, yAxis: { type: 'value' }, series: [{ data: data1, type: 'line', symbol: 'circle', symbolSize: 10, lineStyle: { normal: { color: 'green', width: 4, type: 'solid' } }, itemStyle: { normal: { borderWidth: 3, borderColor: 'green', color: 'green' } } },{ data: data2, type: 'line', symbol: 'circle', symbolSize: 10, lineStyle: { normal: { color: 'blue', width: 4, type: 'dashed' } }, itemStyle: { normal: { borderWidth: 3, borderColor: 'blue', color: 'blue', label : {show: true} } } },{ data: data3, type: 'line', symbol: 'circle', symbolSize: 10, lineStyle: { normal: { color: 'yellow', width: 4, type: 'solid', } }, itemStyle: { normal: { borderWidth: 3, borderColor: 'yellow', color: 'yellow' } } }] };