Sfoglia il codice sorgente

分数段统计

gzb
guozhongbo 1 anno fa
parent
commit
d491dab530
3 ha cambiato i file con 211 aggiunte e 184 eliminazioni
  1. 4
    0
      css/section_1.css
  2. 191
    155
      js/section_1.js
  3. 16
    29
      sections/section_1.html

+ 4
- 0
css/section_1.css Vedi File

@@ -46,4 +46,8 @@
46 46
     margin-top: 3mm;
47 47
     padding: 3mm;
48 48
     background-color: #fff;
49
+}
50
+.curscorelevel{
51
+  background-color: rgba(245, 247, 249, 1);
52
+  padding: 3mm 0 3mm 2mm;
49 53
 }

+ 191
- 155
js/section_1.js Vedi File

@@ -507,9 +507,7 @@ $(function () {
507 507
     myEcharts.setOption(option);
508 508
   }
509 509
 
510
-  function initexamaverageEcharts (list, xAxis_data) {
511
-    console.log(list)
512
-    console.log(xAxis_data)
510
+  function initexamaverageEcharts(list, xAxis_data) {
513 511
     var itemStyle = {
514 512
       normal: {
515 513
         label: {
@@ -769,171 +767,207 @@ $(function () {
769 767
     myEcharts.clear();
770 768
     myEcharts.setOption(option);
771 769
   }
772
-   //图表数据
773
-  function showgraphicaldata(
774
-    xAxis_data,
775
-    legend_data,
776
-    levelrangeObj,
777
-    list
778
-  ) {
770
+  //图表数据
771
+  function showgraphicaldata(xAxis_data, legend_data, levelrangeObj, list) {
779 772
     //图表数据
780 773
     var arr = JSON.parse(JSON.stringify(list));
781
-    var goodTableHeadTr1Html = '<th rowspan="2">班级</th>';
782
-    var goodTableHeadTr2Html = "";
783
-    var goodTableTbodyHtml = "";
784
-    $.each(legend_data, function (idx, item) {
785
-      goodTableHeadTr1Html +=
786
-        '<th colspan="2">' + item + levelrangeObj[idx] + "</th>";
787
-      goodTableHeadTr2Html += "<th>人数</th><th>比例</th>";
788
-    });
789
-    $.each(xAxis_data, function (idx, item) {
790
-      var trHtml = '<td><div class="my_cell">' + item + "</div></td>";
774
+    var tableobj = {};
775
+    var tablehtml = "";
776
+   $.each(xAxis_data, function (idx, item) {
791 777
       var classs = $.grep(arr, function (val) {
792 778
         return val.subjectname == item;
793 779
       });
794
-      $.each(legend_data, function (idx, item) {
795
-        var rank = $.grep(classs, function (val) {
796
-          return val.rankname + "类" == item;
797
-        })[0];
798
-        trHtml +=
780
+      tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] =
781
+        '<th rowspan="2">科目</th>';
782
+      tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] = "";
783
+      tableobj[classs[0].subjectname + "goodTableTbodyHtml"] = "";
784
+      $.each(classs, function (idx, item) {
785
+        tableobj[item.subjectname + "goodTableHeadTr1Html"] +=
786
+          '<th colspan="2">' + item.rankname + "类" + item.rankrange + "</th>";
787
+        tableobj[item.subjectname + "goodTableHeadTr2Html"] +=
788
+          "<th>人数</th><th>比例</th>";
789
+        if (idx == 0) {
790
+          tableobj[item.subjectname + "goodTableTbodyHtml"] +=
791
+            '<td><div class="my_cell">' + item.subjectname + "</div></td>";
792
+        }
793
+        tableobj[item.subjectname + "goodTableTbodyHtml"] +=
799 794
           '<td><div class="my_cell">' +
800
-          rank.stunum +
795
+          item.stunum +
801 796
           '</div></td><td><div class="my_cell">' +
802
-          rank.sturate +
797
+          item.sturate +
803 798
           "%</div></td>";
804 799
       });
805
-      goodTableTbodyHtml += "<tr>" + trHtml + "</tr>";
800
+      tablehtml +=
801
+        '  <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
802
+        tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] +
803
+        '</tr><tr class="goodTableHeadTr2">' +
804
+        tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] +
805
+        '</tr></thead><tbody class="goodTableTbody">' +
806
+        tableobj[classs[0].subjectname + "goodTableTbodyHtml"] +
807
+        "</tbody></table>";
806 808
     });
807
-    $(".section1 .gradescale .goodTableHeadTr1").html(
808
-      goodTableHeadTr1Html
809
-    );
810
-    $(".section1 .gradescale .goodTableHeadTr2").html(
811
-      goodTableHeadTr2Html
812
-    );
813
-    $(".section1 .gradescale .goodTableTbody").html(
814
-      goodTableTbodyHtml
815
-    );
816
-    var totalObj = {};
817
-    var maxObj = {};
818
-    var minObj = {};
819
-    var classObj = {};
820
-    $.each(list, function (index, listItem) {
821
-      if (!totalObj[listItem.rankname]) {
822
-        totalObj[listItem.rankname] = {};
823
-      }
824
-      if (!maxObj[listItem.rankname]) {
825
-        maxObj[listItem.rankname] = {
826
-          stunum: 0,
827
-          classidArr: []
828
-        };
829
-      }
830
-      if (listItem.subjectid === "zf") {
831
-        totalObj[listItem.rankname].stunum = listItem.stunum;
832
-        totalObj[listItem.rankname].sturate = listItem.sturate;
833
-      } else {
834
-        classObj[listItem.classid] = listItem.classname;
835
-        if (maxObj[listItem.rankname].stunum < listItem.stunum) {
836
-          maxObj[listItem.rankname].stunum = listItem.stunum;
837
-          maxObj[listItem.rankname].classidArr = [listItem.classid];
838
-        } else if (maxObj[listItem.rankname].stunum === listItem.stunum) {
839
-          maxObj[listItem.rankname].classidArr.push(listItem.classid);
840
-        }
841
-      }
809
+    $(".section1 .gradescale").html(tablehtml);
810
+  }
811
+
812
+  function initclassscorePartEcharts(list) {
813
+    var xAxis_data = [];
814
+    var dataArr = [];
815
+    var arr = $.grep(list, function (val) {
816
+      return val.subjectid == "zf";
842 817
     });
843
-    $.each(list, function (index, listItem) {
844
-      if (!minObj[listItem.rankname]) {
845
-        minObj[listItem.rankname] = {
846
-          stunum: maxObj[listItem.rankname].stunum,
847
-          classidArr: []
848
-        };
818
+    $.each(arr, function (index, item) {
819
+      xAxis_data.push(item.rankname);
820
+      dataArr.push(item.stunum);
821
+    });
822
+    var series_data = [
823
+      {
824
+        name: "全科",
825
+        type: "line",
826
+        symbol: "circle",
827
+        stack: "全科",
828
+        label: {
829
+          normal: {
830
+            show: true,
831
+            align: "center",
832
+            verticalAlign: "bottom",
833
+            position: "top",
834
+            distance: 0,
835
+            formatter: `{c}`
836
+          }
837
+        },
838
+        data: dataArr
849 839
       }
850
-      if (listItem.classid !== 0) {
851
-        if (minObj[listItem.rankname].stunum > listItem.stunum) {
852
-          minObj[listItem.rankname].stunum = listItem.stunum;
853
-          minObj[listItem.rankname].classidArr = [listItem.classid];
854
-        } else if (minObj[listItem.rankname].stunum === listItem.stunum) {
855
-          minObj[listItem.rankname].classidArr.push(listItem.classid);
840
+    ];
841
+    var option = {
842
+      animation: false,
843
+      title: {
844
+        text: "人",
845
+        x: "left",
846
+        y: "top",
847
+        textStyle: {
848
+          color: "#5F6E82",
849
+          fontSize: $.UnitUtil.mm2px(3),
850
+          fontWeight: 500
856 851
         }
857
-      }
858
-    });
859
-    console.log($(".section1 .result_collect"))
860
-    $(".section1 .result_collect").text(
861
-      "A类" +
862
-        totalObj["A"].stunum +
863
-        "人(" +
864
-        totalObj["A"].sturate +
865
-        "%),B类" +
866
-        totalObj["B"].stunum +
867
-        "人(" +
868
-        totalObj["B"].sturate +
869
-        "%),C类" +
870
-        totalObj["C"].stunum +
871
-        "人(" +
872
-        totalObj["C"].sturate +
873
-        "%),D类" +
874
-        totalObj["D"].stunum +
875
-        "人(" +
876
-        totalObj["D"].sturate +
877
-        "%),E类" +
878
-        totalObj["E"].stunum +
879
-        "人(" +
880
-        totalObj["E"].sturate +
881
-        "%)"
882
-    );
883
-    $(".section1 .A_collect").text(
884
-      "A类上线率最高的班级:" +
885
-        $.map(maxObj["A"].classidArr, function (classid) {
886
-          return classObj[classid];
887
-        }).join("、") +
888
-        ",A类上线率最低的班级:" +
889
-        $.map(minObj["A"].classidArr, function (classid) {
890
-          return classObj[classid];
891
-        }).join("、")
892
-    );
893
-
894
-    $(".section1 .B_collect").text(
895
-      "B类上线率最高的班级:" +
896
-        $.map(maxObj["B"].classidArr, function (classid) {
897
-          return classObj[classid];
898
-        }).join("、") +
899
-        ",B类上线率最低的班级:" +
900
-        $.map(minObj["B"].classidArr, function (classid) {
901
-          return classObj[classid];
902
-        }).join("、")
903
-    );
904
-
905
-    $(".section1 .C_collect").text(
906
-      "C类上线率最高的班级:" +
907
-        $.map(maxObj["C"].classidArr, function (classid) {
908
-          return classObj[classid];
909
-        }).join("、") +
910
-        ",C类上线率最低的班级:" +
911
-        $.map(minObj["C"].classidArr, function (classid) {
912
-          return classObj[classid];
913
-        }).join("、")
914
-    );
915
-
916
-    $(".section1 .D_collect").text(
917
-      "D类上线率最高的班级:" +
918
-        $.map(maxObj["D"].classidArr, function (classid) {
919
-          return classObj[classid];
920
-        }).join("、") +
921
-        ",D类上线率最低的班级:" +
922
-        $.map(minObj["D"].classidArr, function (classid) {
923
-          return classObj[classid];
924
-        }).join("、")
852
+      },
853
+      color: ["#5C99FF", "#ff5f56", "#5EC5C8", "#f1982b", "#6e5eff"],
854
+      legend: {
855
+        icon: "roundRect",
856
+        itemWidth: $.UnitUtil.mm2px(2),
857
+        itemHeight: $.UnitUtil.mm2px(2),
858
+        top: "bottom",
859
+        data: ["全科"]
860
+      },
861
+      grid: {
862
+        top: $.UnitUtil.mm2px(10),
863
+        left: 0,
864
+        right: 0,
865
+        bottom: $.UnitUtil.mm2px(8),
866
+        containLabel: true
867
+      },
868
+      xAxis: {
869
+        type: "category",
870
+        axisLabel: {
871
+          textStyle: {
872
+            color: "#5F6E82"
873
+          },
874
+          interval: 2,
875
+          rotate: 0
876
+        },
877
+        axisTick: {
878
+          show: false
879
+        },
880
+        data: xAxis_data
881
+      },
882
+      yAxis: {
883
+        axisLabel: {
884
+          textStyle: {
885
+            color: "#9B9B9BFF"
886
+          },
887
+          interval: 0
888
+        },
889
+        minInterval: 1,
890
+        axisLine: {
891
+          show: false
892
+        },
893
+        axisTick: {
894
+          show: false
895
+        },
896
+        splitLine: {
897
+          //网格线
898
+          lineStyle: {
899
+            type: "dotted", //设置网格线类型 dotted:虚线   solid:实线
900
+            color: "#DADADA"
901
+          },
902
+          show: true //隐藏或显示
903
+        },
904
+        type: "value"
905
+      },
906
+      series: series_data
907
+    };
908
+    var myEcharts = echarts.init(
909
+      document.querySelector(".section1 #classscorePartEcharts")
925 910
     );
911
+    myEcharts.clear();
912
+    myEcharts.setOption(option);
913
+    showscoredistributiondata(list,xAxis_data,dataArr);
914
+  }
926 915
 
927
-    $(".section1 .E_collect").text(
928
-      "E类上线率最高的班级:" +
929
-        $.map(maxObj["E"].classidArr, function (classid) {
930
-          return classObj[classid];
931
-        }).join("、") +
932
-        ",E类上线率最低的班级:" +
933
-        $.map(minObj["E"].classidArr, function (classid) {
934
-          return classObj[classid];
935
-        }).join("、")
936
-    );
916
+  function showscoredistributiondata(list,xAxis_data) {
917
+    var tableobj = {};
918
+    var num = -1, rownum = 6;//一行六条数据
919
+    $.each(xAxis_data,function (idx,item) {
920
+      var obj = $.grep(list, function (val) {
921
+        return val.rankname == item && val.subjectid == "zf";
922
+      })[0]
923
+       if ((idx + rownum) % rownum == 0) {
924
+        num++;
925
+        tableobj[num + "goodTableHeadTr1Html"] = '<th rowspan="2">班级</th>';
926
+         tableobj[num + "goodTableHeadTr2Html"] = "";
927
+          tableobj[num+"trHtml"] = '<td><div class="my_cell">全科</div></td>';
928
+      } 
929
+      tableobj[num + "goodTableHeadTr1Html"] += '<th colspan="2">' + item + "</th>";
930
+      tableobj[num + "goodTableHeadTr2Html"] += "<th>人数</th><th>比例</th>";
931
+       tableobj[num+"trHtml"] +=
932
+          '<td><div class="my_cell">' +
933
+          obj.stunum +
934
+          '</div></td><td><div class="my_cell">' +
935
+          obj.sturate +
936
+          "%</div></td>";
937
+    })
938
+       //计算表格高度 页面高1047 剩余高度582 表头62.5  内容27.42
939
+    var tableheight = (27.5+62.5 +15) *(num+1);
940
+    var page = {
941
+      1:"",2:"",3:""
942
+    }; //页数
943
+    var table = "";
944
+    var itemheight = 27.5 + 62.5 + 15; //单表高度
945
+    var maxheight = 0;
946
+    for (var i = 0; i < num + 1; i++){
947
+      maxheight = itemheight * (i + 1)
948
+      var content = '  <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
949
+        tableobj[i + "goodTableHeadTr1Html"] + '</tr><tr class="goodTableHeadTr2">' +
950
+        tableobj[i + "goodTableHeadTr2Html"] + '</tr></thead><tbody class="goodTableTbody">' +
951
+        tableobj[i + "trHtml"] + '</tbody></table>';
952
+      //计算剩余高度是否能显示最后一个表格
953
+      if (maxheight > 582 && 582-maxheight<itemheight) {
954
+        page[1] += content;
955
+      } else if (maxheight > 1629 && 1629-maxheight<itemheight) {
956
+        page[2] += content;
957
+      } else {
958
+        table += content;
959
+      }
960
+    }
961
+       $(".table_num0 .scoredistribution").html(table);
962
+    if (tableheight > 582) {
963
+      //添加第一页
964
+      $(".table_num0").after('<div class="page_root section_2_part table_num1"></div>')
965
+      $(".table_num1").html(page[1]);
966
+    } else if (tableheight > 1629) {
967
+      //添加第二页
968
+      $(".table_num1").after('<div class="page_root section_2_part table_num2"></div>')
969
+      $(".table_num2").html(page[2]);
970
+    } 
937 971
   }
938 972
   var parameter = JSON.parse($(".section_1_html_root").data("page-params"));
939 973
   var xAxis_data = [],
@@ -1056,7 +1090,7 @@ $(function () {
1056 1090
       "%" +
1057 1091
       '</div></td><td><div class="my_cell">' +
1058 1092
       (item.bzc || 0) +
1059
-      "</div></td></tr>";
1093
+      "%</div></td></tr>";
1060 1094
     xAxis_data.push(item.subjectname);
1061 1095
   }
1062 1096
   goodclass.classname = goodclass.classname.substr(
@@ -1067,7 +1101,7 @@ $(function () {
1067 1101
     0,
1068 1102
     badclass.classname.length - 1
1069 1103
   );
1070
-  console.log(parameter.fsdjtj);
1104
+  console.log(parameter);
1071 1105
   $(".section1 .mfclass").text(mfclass.classname); //满分
1072 1106
   $(".section1 .yxclass").text(yxclass.classname); //优秀
1073 1107
   $(".section1 .lhclass").text(lhclass.classname); //良好
@@ -1084,4 +1118,6 @@ $(function () {
1084 1118
   initbzcEcharts(parameter.xkcj, xAxis_data);
1085 1119
   initexamaverageEcharts(parameter.xkcj, xAxis_data);
1086 1120
   initscoreGradeEcharts(parameter.fsdjtj, xAxis_data);
1121
+  initclassscorePartEcharts(parameter.fsdtj);
1122
+  document.documentElement.scrollTop = 4200;
1087 1123
 });

+ 16
- 29
sections/section_1.html Vedi File

@@ -139,36 +139,23 @@
139 139
     </div>
140 140
     <div class="page_root section1">
141 141
       <h3 class="section_title_3">3.2 各科等级比例分析</h3>
142
-      <div class="gradescale">
143
-        <table border="1" class="my_table">
144
-          <thead>
145
-            <tr class="goodTableHeadTr1"></tr>
146
-            <tr class="goodTableHeadTr2"></tr>
147
-          </thead>
148
-          <tbody class="goodTableTbody"></tbody>
149
-        </table>
150
-      </div>
151
-      <div class="echarts_result">
152
-        <div>
153
-          上图各等级上线统计结果为:<span class="result_collect"></span>:
154
-        </div>
155
-        <div class="echarts_result_content">
156
-          <div>
157
-            <span class="bg_5699FF"></span><i class="A_collect"></i>
158
-          </div>
159
-          <div>
160
-            <span class="bg_FF5F56"></span><i class="B_collect"></i>
161
-          </div>
162
-          <div>
163
-            <span class="bg_5EC5C8"></span><i class="C_collect"></i>
164
-          </div>
165
-          <div>
166
-            <span class="bg_F1982B"></span><i class="D_collect"></i>
167
-          </div>
168
-          <div>
169
-            <span class="bg_F1982B"></span><i class="E_collect"></i>
170
-          </div>
142
+      <div class="gradescale"></div>
143
+    </div>
144
+    <div class="page_root section1 table_num0">
145
+      <div>
146
+        <h2 class="section_title_2">4.分数段统计</h2>
147
+        <h3 class="section_title_3">4.1 各科分数段分析</h3>
148
+        <div class="curscorelevel">
149
+          当前设置分数段:<span class="classPartEcharts">20</span>分/段
171 150
         </div>
151
+        <div
152
+          id="classscorePartEcharts"
153
+          style="margin: 0 4mm 4mm; height: 80mm"
154
+        ></div>
155
+        <h3 class="section_title_3">4.2 各科分数段比例分布</h3>
156
+      </div>
157
+
158
+      <div class="scoredistribution"></div>
172 159
     </div>
173 160
     <script src="../js/section_1.js"></script>
174 161
   </body>

Loading…
Annulla
Salva