|
@@ -0,0 +1,213 @@
|
|
1
|
+$(function () {
|
|
2
|
+ // 优秀生、学困生统计
|
|
3
|
+ function initClassExcellenceEcharts(r_data_item, s_index) {
|
|
4
|
+ var legend_data = ["优秀生", "学困生"];
|
|
5
|
+ var xAxis_data = [];
|
|
6
|
+ var series_data1 = [];
|
|
7
|
+ var series_data2 = [];
|
|
8
|
+ $.each(r_data_item.ranks, function (index, r_item) {
|
|
9
|
+ xAxis_data.push(r_item.classname);
|
|
10
|
+ series_data1.push(r_item.stujson[0].stunum);
|
|
11
|
+ series_data2.push(-r_item.stujson[1].stunum);
|
|
12
|
+ });
|
|
13
|
+ var option = {
|
|
14
|
+ title: {
|
|
15
|
+ text: "人",
|
|
16
|
+ x: "left",
|
|
17
|
+ y: "top",
|
|
18
|
+ textStyle: {
|
|
19
|
+ color: "#5F6E82",
|
|
20
|
+ fontSize: 12,
|
|
21
|
+ fontWeight: 500
|
|
22
|
+ }
|
|
23
|
+ },
|
|
24
|
+ color: ["#5C99FF", "#F39A2C"],
|
|
25
|
+ legend: {
|
|
26
|
+ itemWidth: 6,
|
|
27
|
+ itemHeight: 6,
|
|
28
|
+ bottom: 30,
|
|
29
|
+ data: legend_data
|
|
30
|
+ },
|
|
31
|
+ grid: {
|
|
32
|
+ top: 30,
|
|
33
|
+ left: 5,
|
|
34
|
+ right: 0,
|
|
35
|
+ bottom: 65,
|
|
36
|
+ containLabel: true
|
|
37
|
+ },
|
|
38
|
+ xAxis: [
|
|
39
|
+ {
|
|
40
|
+ type: "category",
|
|
41
|
+ offset: 10,
|
|
42
|
+ position: "bottom",
|
|
43
|
+ data: xAxis_data,
|
|
44
|
+ axisLabel: {
|
|
45
|
+ color: "#5F6E82" //更改坐标轴文字颜色
|
|
46
|
+ },
|
|
47
|
+ axisTick: {
|
|
48
|
+ alignWithLabel: true
|
|
49
|
+ },
|
|
50
|
+ boundaryGap: true,
|
|
51
|
+ triggerEvent: true,
|
|
52
|
+ axisLine: {
|
|
53
|
+ show: true, //是否显示轴线
|
|
54
|
+ lineStyle: {
|
|
55
|
+ color: "#DADADA" //刻度线的颜色
|
|
56
|
+ }
|
|
57
|
+ }
|
|
58
|
+ }
|
|
59
|
+ ],
|
|
60
|
+ yAxis: [
|
|
61
|
+ {
|
|
62
|
+ type: "value",
|
|
63
|
+ axisTick: {
|
|
64
|
+ show: false //刻度
|
|
65
|
+ },
|
|
66
|
+ axisLine: {
|
|
67
|
+ show: false, //是否显示轴线
|
|
68
|
+ lineStyle: {
|
|
69
|
+ color: "#DADADA" //刻度线的颜色
|
|
70
|
+ }
|
|
71
|
+ },
|
|
72
|
+ splitLine: {
|
|
73
|
+ //网格线
|
|
74
|
+ lineStyle: {
|
|
75
|
+ type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
|
|
76
|
+ },
|
|
77
|
+ show: true //隐藏或显示
|
|
78
|
+ },
|
|
79
|
+ axisLabel: {
|
|
80
|
+ color: "#5F6E82" //更改坐标轴文字颜色
|
|
81
|
+ }
|
|
82
|
+ }
|
|
83
|
+ ],
|
|
84
|
+ series: [
|
|
85
|
+ {
|
|
86
|
+ name: legend_data[0],
|
|
87
|
+ type: "bar",
|
|
88
|
+ stack: "one",
|
|
89
|
+ barWidth: 32,
|
|
90
|
+ // 柱状图最小高度
|
|
91
|
+ barMinHeight: 0,
|
|
92
|
+ barGap: 0,
|
|
93
|
+ label: {
|
|
94
|
+ normal: {
|
|
95
|
+ show: true,
|
|
96
|
+ align: "center",
|
|
97
|
+ verticalAlign: "bottom",
|
|
98
|
+ position: "top",
|
|
99
|
+ distance: 0
|
|
100
|
+ }
|
|
101
|
+ },
|
|
102
|
+ data: series_data1
|
|
103
|
+ },
|
|
104
|
+ {
|
|
105
|
+ name: legend_data[1],
|
|
106
|
+ type: "bar",
|
|
107
|
+ stack: "one",
|
|
108
|
+ barWidth: 32,
|
|
109
|
+ // 柱状图最小高度
|
|
110
|
+ barMinHeight: 0,
|
|
111
|
+ barGap: 0,
|
|
112
|
+ label: {
|
|
113
|
+ normal: {
|
|
114
|
+ show: true,
|
|
115
|
+ align: "center",
|
|
116
|
+ verticalAlign: "top",
|
|
117
|
+ position: "bottom",
|
|
118
|
+ distance: 0,
|
|
119
|
+ formatter: function (params) {
|
|
120
|
+ return Math.abs(params.value);
|
|
121
|
+ }
|
|
122
|
+ }
|
|
123
|
+ },
|
|
124
|
+ data: series_data2
|
|
125
|
+ }
|
|
126
|
+ ]
|
|
127
|
+ };
|
|
128
|
+ var myEcharts = echarts.init(document.querySelector(".section_2_excellent.section_2_excellent_" + s_index + " #classExcellenceEcharts"));
|
|
129
|
+ myEcharts.clear();
|
|
130
|
+ myEcharts.setOption(option);
|
|
131
|
+ }
|
|
132
|
+ var parameter = $(".section_2_html_root .section_2_excellent_html_root").data("page-params");
|
|
133
|
+ parameter = JSON.parse(parameter);
|
|
134
|
+ console.log(".section_2_excellent_html_root:parameter", parameter);
|
|
135
|
+
|
|
136
|
+ var subjectInfo = [];
|
|
137
|
+ for (var sid in parameter) {
|
|
138
|
+ if (sid === "zf") {
|
|
139
|
+ subjectInfo.unshift({
|
|
140
|
+ subjectid: sid,
|
|
141
|
+ subjectname: "全科",
|
|
142
|
+ });
|
|
143
|
+ } else {
|
|
144
|
+ subjectInfo.push({
|
|
145
|
+ subjectid: sid,
|
|
146
|
+ subjectname: parameter[sid].subjectname,
|
|
147
|
+ });
|
|
148
|
+ }
|
|
149
|
+ }
|
|
150
|
+ var singleRootHtml = "";
|
|
151
|
+ $.each(subjectInfo, function (s_index, s_item) {
|
|
152
|
+ singleRootHtml += '<div class="page_root section_2_excellent section_2_excellent_' + s_index + '">' + (s_index === 0 ? '<h2 class="section_title_2">5. 优秀生、学困生对比</h2>' : "") + '<h3 class="section_title_3">5.' + (s_index + 1) + ' <span class="subjectname"></span>优秀生、学困生对比</h3><h4 class="section_title_4">5.' + (s_index + 1) + '.1 各班的优秀生、学困生对比</h4><div class="echarts_result">优秀生:年级前<span class="c_5699FF excellent_linescore"></span>名<span class="margin_left_6mm">学困生:年级后<span class="c_5699FF excellent_floatscore"></span>名</span></div><div id="classExcellenceEcharts" style="margin: 0 4mm 4mm;height: 120mm;"></div></div><div class="page_root section_2_excellent section_2_excellent_' + s_index + '"><h4 class="section_title_4">5.' + (s_index + 1) + '.2 各班优秀生、学困生占比分布</h4><table border="1" class="my_table"><thead><tr><th>班级</th><th class="linescore_num"></th><th>占比</th><th class="floatscore_num">后10名</th><th>占比</th></tr></thead><tbody class="excellent_rank_tbody"></tbody></table><div class="echarts_result"><div>上图统计结果表示:</div><div class="echarts_result_content"><div><span class="dot bg_5699FF"></span>年级<span class="linescore_num"></span>优秀生最多的班级:<span class="excellent_rank_good"></span></div><div><span class="dot bg_FF5F56"></span>年级<span class="floatscore_num"></span>学困生最多的班级:<span class="excellent_rank_bad"></span></div></div></div></div>';
|
|
153
|
+ });
|
|
154
|
+ $(".section_2_excellent_root").html(singleRootHtml);
|
|
155
|
+ $.each(subjectInfo, function (s_index, s_item) {
|
|
156
|
+ var r_data_item = parameter[s_item.subjectid];
|
|
157
|
+ console.log("r_data_item", r_data_item);
|
|
158
|
+ $(".section_2_excellent_" + s_index + " .subjectname").text(
|
|
159
|
+ r_data_item.subjectname
|
|
160
|
+ );
|
|
161
|
+ $(".section_2_excellent_" + s_index + " .excellent_linescore").text(
|
|
162
|
+ r_data_item.linescore
|
|
163
|
+ );
|
|
164
|
+ $(".section_2_excellent_" + s_index + " .excellent_floatscore").text(
|
|
165
|
+ r_data_item.floatscore
|
|
166
|
+ );
|
|
167
|
+ initClassExcellenceEcharts(r_data_item, s_index);
|
|
168
|
+ var excellent_rank_tbody_html = "";
|
|
169
|
+ // 优秀生最多的班级
|
|
170
|
+ var goodClassInfo = {
|
|
171
|
+ stunum: 0,
|
|
172
|
+ classname: "",
|
|
173
|
+ };
|
|
174
|
+ // 学困生最多的班级
|
|
175
|
+ var badClassInfo = {
|
|
176
|
+ stunum: 0,
|
|
177
|
+ classname: "",
|
|
178
|
+ };
|
|
179
|
+ $(".section_2_excellent_" + s_index + " .linescore_num").text("前" + r_data_item.linescore + "名");
|
|
180
|
+ $(".section_2_excellent_" + s_index + " .floatscore_num").text("后" + r_data_item.floatscore + "名");
|
|
181
|
+ $.each(r_data_item.ranks, function (index, r_item) {
|
|
182
|
+ if (r_item.classid !== 0 && goodClassInfo.stunum < r_item.stujson[0].stunum) {
|
|
183
|
+ goodClassInfo.stunum = r_item.stujson[0].stunum;
|
|
184
|
+ goodClassInfo.classname = r_item.classname;
|
|
185
|
+ }
|
|
186
|
+ if (r_item.classid !== 0 && badClassInfo.stunum < r_item.stujson[0].stunum) {
|
|
187
|
+ badClassInfo.stunum = r_item.stujson[0].stunum;
|
|
188
|
+ badClassInfo.classname = r_item.classname;
|
|
189
|
+ }
|
|
190
|
+ excellent_rank_tbody_html +=
|
|
191
|
+ '<tr><td><div class="my_cell">' +
|
|
192
|
+ r_item.classname +
|
|
193
|
+ '</div></td><td><div class="my_cell">' +
|
|
194
|
+ r_item.stujson[0].stunum +
|
|
195
|
+ '</div></td><td><div class="my_cell">' +
|
|
196
|
+ r_item.stujson[0].sturate +
|
|
197
|
+ '%</div></td><td><div class="my_cell">' +
|
|
198
|
+ r_item.stujson[1].stunum +
|
|
199
|
+ '</div></td><td><div class="my_cell">' +
|
|
200
|
+ r_item.stujson[1].sturate +
|
|
201
|
+ '%</div></td></tr>';
|
|
202
|
+ });
|
|
203
|
+ $(".section_2_excellent_" + s_index + " .excellent_rank_tbody").html(
|
|
204
|
+ excellent_rank_tbody_html
|
|
205
|
+ );
|
|
206
|
+ $(".section_2_excellent_" + s_index + " .excellent_rank_good").html(
|
|
207
|
+ goodClassInfo.classname
|
|
208
|
+ );
|
|
209
|
+ $(".section_2_excellent_" + s_index + " .excellent_rank_bad").html(
|
|
210
|
+ badClassInfo.classname
|
|
211
|
+ );
|
|
212
|
+ });
|
|
213
|
+});
|