You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

section_2_lin.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. $(function () {
  2. // 按名次统计
  3. function initClassCriticalRankEcharts(r_data_item, s_index) {
  4. var linescore = r_data_item.linescore;
  5. var legend_data = [">" + linescore + "名", "≤" + linescore + "名"];
  6. var xAxis_data = [];
  7. var series_data1 = [];
  8. var series_data2 = [];
  9. $.each(r_data_item.ranks, function (index, r_item) {
  10. xAxis_data.push(r_item.classname);
  11. series_data1.push(r_item.dynum);
  12. series_data2.push(-r_item.xynum);
  13. });
  14. var option = {
  15. title: {
  16. text: "人",
  17. x: "left",
  18. y: "top",
  19. textStyle: {
  20. color: "#5F6E82",
  21. fontSize: 12,
  22. fontWeight: 500,
  23. },
  24. },
  25. color: ["#5C99FF", "#F39A2C"],
  26. legend: {
  27. itemWidth: 6,
  28. itemHeight: 6,
  29. bottom: 30,
  30. data: legend_data,
  31. },
  32. grid: {
  33. top: 30,
  34. left: 5,
  35. right: 0,
  36. bottom: 65,
  37. containLabel: true,
  38. },
  39. xAxis: [
  40. {
  41. type: "category",
  42. offset: 10,
  43. position: "bottom",
  44. data: xAxis_data,
  45. axisLabel: {
  46. color: "#5F6E82", //更改坐标轴文字颜色
  47. },
  48. axisTick: {
  49. alignWithLabel: true,
  50. },
  51. boundaryGap: true,
  52. triggerEvent: true,
  53. axisLine: {
  54. show: true, //是否显示轴线
  55. lineStyle: {
  56. color: "#DADADA", //刻度线的颜色
  57. },
  58. },
  59. },
  60. ],
  61. yAxis: [
  62. {
  63. type: "value",
  64. axisTick: {
  65. show: false, //刻度
  66. },
  67. axisLine: {
  68. show: false, //是否显示轴线
  69. lineStyle: {
  70. color: "#DADADA", //刻度线的颜色
  71. },
  72. },
  73. splitLine: {
  74. //网格线
  75. lineStyle: {
  76. type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
  77. },
  78. show: true, //隐藏或显示
  79. },
  80. axisLabel: {
  81. color: "#5F6E82", //更改坐标轴文字颜色
  82. },
  83. },
  84. ],
  85. series: [
  86. {
  87. name: legend_data[0],
  88. type: "bar",
  89. stack: "one",
  90. barWidth: 32,
  91. // 柱状图最小高度
  92. barMinHeight: 0,
  93. barGap: 0,
  94. label: {
  95. normal: {
  96. show: true,
  97. align: "center",
  98. verticalAlign: "bottom",
  99. position: "top",
  100. distance: 0,
  101. },
  102. },
  103. data: series_data1,
  104. },
  105. {
  106. name: legend_data[1],
  107. type: "bar",
  108. stack: "one",
  109. barWidth: 32,
  110. // 柱状图最小高度
  111. barMinHeight: 0,
  112. barGap: 0,
  113. label: {
  114. normal: {
  115. show: true,
  116. align: "center",
  117. verticalAlign: "top",
  118. position: "bottom",
  119. distance: 0,
  120. formatter: function (params) {
  121. return Math.abs(params.value);
  122. },
  123. },
  124. },
  125. data: series_data2,
  126. },
  127. ],
  128. };
  129. var myEcharts = echarts.init(
  130. document.querySelector(
  131. ".section_2_lin.section_2_lin_" + s_index + " #classCriticalRankEcharts"
  132. )
  133. );
  134. myEcharts.clear();
  135. myEcharts.setOption(option);
  136. }
  137. // 按分数统计
  138. function initClassCriticalScoreEcharts(s_data_item, s_index) {
  139. var linescore = s_data_item.linescore;
  140. var legend_data = [">" + linescore + "分", "≤" + linescore + "分"];
  141. var xAxis_data = [];
  142. var series_data1 = [];
  143. var series_data2 = [];
  144. $.each(s_data_item.ranks, function (index, r_item) {
  145. xAxis_data.push(r_item.classname);
  146. series_data1.push(r_item.dynum);
  147. series_data2.push(-r_item.xynum);
  148. });
  149. var option = {
  150. title: {
  151. text: "人",
  152. x: "left",
  153. y: "top",
  154. textStyle: {
  155. color: "#5F6E82",
  156. fontSize: 12,
  157. fontWeight: 500,
  158. },
  159. },
  160. color: ["#5C99FF", "#F39A2C"],
  161. legend: {
  162. itemWidth: 6,
  163. itemHeight: 6,
  164. bottom: 30,
  165. data: legend_data,
  166. },
  167. grid: {
  168. top: 30,
  169. left: 5,
  170. right: 0,
  171. bottom: 65,
  172. containLabel: true,
  173. },
  174. xAxis: [
  175. {
  176. type: "category",
  177. offset: 10,
  178. position: "bottom",
  179. data: xAxis_data,
  180. axisLabel: {
  181. color: "#5F6E82", //更改坐标轴文字颜色
  182. },
  183. axisTick: {
  184. alignWithLabel: true,
  185. },
  186. boundaryGap: true,
  187. triggerEvent: true,
  188. axisLine: {
  189. show: true, //是否显示轴线
  190. lineStyle: {
  191. color: "#DADADA", //刻度线的颜色
  192. },
  193. },
  194. },
  195. ],
  196. yAxis: [
  197. {
  198. type: "value",
  199. axisTick: {
  200. show: false, //刻度
  201. },
  202. axisLine: {
  203. show: false, //是否显示轴线
  204. lineStyle: {
  205. color: "#DADADA", //刻度线的颜色
  206. },
  207. },
  208. splitLine: {
  209. //网格线
  210. lineStyle: {
  211. type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
  212. },
  213. show: true, //隐藏或显示
  214. },
  215. axisLabel: {
  216. color: "#5F6E82", //更改坐标轴文字颜色
  217. },
  218. },
  219. ],
  220. series: [
  221. {
  222. name: legend_data[0],
  223. type: "bar",
  224. stack: "one",
  225. barWidth: 32,
  226. // 柱状图最小高度
  227. barMinHeight: 0,
  228. barGap: 0,
  229. label: {
  230. normal: {
  231. show: true,
  232. align: "center",
  233. verticalAlign: "bottom",
  234. position: "top",
  235. distance: 0,
  236. },
  237. },
  238. data: series_data1,
  239. },
  240. {
  241. name: legend_data[1],
  242. type: "bar",
  243. stack: "one",
  244. barWidth: 32,
  245. // 柱状图最小高度
  246. barMinHeight: 0,
  247. barGap: 0,
  248. label: {
  249. normal: {
  250. show: true,
  251. align: "center",
  252. verticalAlign: "top",
  253. position: "bottom",
  254. distance: 0,
  255. formatter: function (params) {
  256. return Math.abs(params.value);
  257. },
  258. },
  259. },
  260. data: series_data2,
  261. },
  262. ],
  263. };
  264. var myEcharts = echarts.init(
  265. document.querySelector(".section_2_lin.section_2_lin_" + s_index + " #classCriticalScoreEcharts")
  266. );
  267. myEcharts.clear();
  268. myEcharts.setOption(option);
  269. }
  270. var parameter = $(".section_2_html_root .section_2_lin_html_root").data(
  271. "page-params"
  272. );
  273. parameter = JSON.parse(parameter);
  274. var subjectInfo = [];
  275. var subjectid_ranktype = {};
  276. for (var sid_3 in parameter[3]) {
  277. if (sid_3 === "zf") {
  278. subjectInfo.unshift({
  279. subjectid: sid_3,
  280. subjectname: "全科",
  281. });
  282. } else {
  283. subjectInfo.push({
  284. subjectid: sid_3,
  285. subjectname: parameter[3][sid_3].subjectname,
  286. });
  287. }
  288. if (!subjectid_ranktype[sid_3]) {
  289. subjectid_ranktype[sid_3] = {};
  290. }
  291. subjectid_ranktype[sid_3][3] = parameter[3][sid_3];
  292. }
  293. for (var sid_4 in parameter[4]) {
  294. if (!subjectid_ranktype[sid_4]) {
  295. subjectid_ranktype[sid_4] = {};
  296. }
  297. subjectid_ranktype[sid_4][4] = parameter[4][sid_4];
  298. }
  299. // console.log("subjectid_ranktype", subjectid_ranktype);
  300. var singleRootHtml = "";
  301. $.each(subjectInfo, function (s_index, s_item) {
  302. singleRootHtml +=
  303. '<div class="page_root section_2_lin section_2_lin_' +
  304. s_index +
  305. '">' +
  306. (s_index === 0 ? '<h2 class="section_title_2">4.临界生对比</h2>' : "") +
  307. '<h3 class="section_title_3">4.' +
  308. (s_index + 1) +
  309. ' <span class="subjectname"></span>临界生对比</h3><h4 class="section_title_4">4.' +
  310. (s_index + 1) +
  311. '.1 各班临界生对比分析</h4><div class="echarts_result"><div>按名次统计</div><div class="echarts_result_content"><div>临界名次:<span class="lin_rank_num c_5699FF"></span>名<span class="margin_left_6mm margin_right_6mm">浮动名次:<span class="lin_rank_float c_FF5F56"></span>名</span>名次区间:<span class="lin_rank_range c_5699FF"></span>名</div></div></div><div id="classCriticalRankEcharts" style="margin: 0 4mm 4mm; height: 120mm"></div></div><div class="page_root section_2_lin section_2_lin_' +
  312. s_index +
  313. '"><h4 class="section_title_4">4.' +
  314. (s_index + 1) +
  315. '.2 各班名次整体分析</h4><table border="1" class="my_table"><thead><tr><th>班级</th><th>人数</th><th>占比</th></tr></thead><tbody class="lin_rank_tbody"></tbody></table><div class="echarts_result"><div>上图统计结果表示:</div><div class="echarts_result_content"><div><span class="dot bg_FF5F56"></span>临界生最多的班级:<span class="lin_rank_max"></span></div></div></div></div><div class="page_root section_2_lin section_2_lin_' +
  316. s_index +
  317. '"><div class="echarts_result"><div>按分数统计</div><div class="echarts_result_content"><div>临界分:<span class="lin_score_num c_5699FF"></span>分<span class="margin_left_6mm margin_right_6mm">浮动分:<span class="lin_score_float c_FF5F56"></span>分</span>分数区间:<span class="lin_score_range c_5699FF"></span>分</div></div></div><div id="classCriticalScoreEcharts" style="margin: 0 4mm 4mm; height: 120mm"></div></div><div class="page_root section_2_lin section_2_lin_' +
  318. s_index +
  319. '"><h4 class="section_title_4">4.' +
  320. (s_index + 1) +
  321. '.3 各班分数整体分析</h4><table border="1" class="my_table"><thead><tr><th>班级</th><th>人数</th><th>占比</th></tr></thead><tbody class="lin_score_tbody"></tbody></table><div class="echarts_result"><div>上图统计结果表示:</div><div class="echarts_result_content"><div><span class="dot bg_FF5F56"></span>临界生最多的班级:<span class="lin_score_max"></span></div></div></div></div>';
  322. });
  323. $(".section_2_lin_root").html(singleRootHtml);
  324. $.each(subjectInfo, function (s_index, s_item) {
  325. var r_data_item = subjectid_ranktype[s_item.subjectid][4];
  326. // console.log("r_data_item", r_data_item);
  327. // 按名次统计
  328. $(".section_2_lin_" + s_index + " .subjectname").text(
  329. r_data_item.subjectname
  330. );
  331. $(".section_2_lin_" + s_index + " .lin_rank_num").text(
  332. r_data_item.linescore
  333. );
  334. $(".section_2_lin_" + s_index + " .lin_rank_float").text(
  335. r_data_item.floatscore
  336. );
  337. $(".section_2_lin_" + s_index + " .lin_rank_range").text(
  338. r_data_item.maxscore + " - " + r_data_item.minscore
  339. );
  340. initClassCriticalRankEcharts(r_data_item, s_index);
  341. var lin_rank_tbody_html = "";
  342. var linRankMaxInfo = {
  343. stunum: 0,
  344. classname: "",
  345. };
  346. $.each(r_data_item.ranks, function (index, r_item) {
  347. if (r_item.classid !== 0 && linRankMaxInfo.stunum < r_item.stunum) {
  348. linRankMaxInfo.stunum = r_item.stunum;
  349. linRankMaxInfo.classname = r_item.classname;
  350. }
  351. lin_rank_tbody_html +=
  352. '<tr><td><div class="my_cell">' +
  353. r_item.classname +
  354. '</div></td><td><div class="my_cell">' +
  355. r_item.stunum +
  356. '</div></td><td><div class="my_cell">' +
  357. r_item.sturate +
  358. "%</div></td></tr>";
  359. });
  360. $(".section_2_lin_" + s_index + " .lin_rank_tbody").html(
  361. lin_rank_tbody_html
  362. );
  363. $(".section_2_lin_" + s_index + " .lin_rank_max").html(
  364. linRankMaxInfo.classname
  365. );
  366. // 按分数统计
  367. var s_data_item = subjectid_ranktype[s_item.subjectid][3];
  368. // console.log("s_data_item", s_data_item);
  369. $(".section_2_lin_" + s_index + " .lin_score_num").text(
  370. s_data_item.linescore
  371. );
  372. $(".section_2_lin_" + s_index + " .lin_score_float").text(
  373. s_data_item.floatscore
  374. );
  375. $(".section_2_lin_" + s_index + " .lin_score_range").text(
  376. s_data_item.minscore + " - " + s_data_item.maxscore
  377. );
  378. initClassCriticalScoreEcharts(s_data_item, s_index);
  379. var lin_score_tbody_html = "";
  380. var linScoreMaxInfo = {
  381. stunum: 0,
  382. classname: "",
  383. };
  384. $.each(s_data_item.ranks, function (index, r_item) {
  385. if (r_item.classid !== 0 && linScoreMaxInfo.stunum < r_item.stunum) {
  386. linScoreMaxInfo.stunum = r_item.stunum;
  387. linScoreMaxInfo.classname = r_item.classname;
  388. }
  389. lin_score_tbody_html +=
  390. '<tr><td><div class="my_cell">' +
  391. r_item.classname +
  392. '</div></td><td><div class="my_cell">' +
  393. r_item.stunum +
  394. '</div></td><td><div class="my_cell">' +
  395. r_item.sturate +
  396. "%</div></td></tr>";
  397. });
  398. $(".section_2_lin_" + s_index + " .lin_score_tbody").html(
  399. lin_score_tbody_html
  400. );
  401. $(".section_2_lin_" + s_index + " .lin_score_max").html(
  402. linScoreMaxInfo.classname
  403. );
  404. });
  405. });