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_1.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. $(function () {
  2. function initAverageScoreEcharts(list,xAxis_data) {
  3. var itemStyle = {
  4. normal: {
  5. label: {
  6. show: true, //开启显示数值
  7. position: "top" //数值在上方显示
  8. }
  9. }
  10. };
  11. var score=[],maxscore=[],minscore=[],avgscore=[];
  12. var curlegend = ["满分", "最高分", "最低分", "平均分"];
  13. for(var i=0;i<list.length;i++){
  14. var item = list[i];
  15. score.push(item.score);
  16. maxscore.push(item.maxscore);
  17. minscore.push(item.minscore);
  18. avgscore.push(item.avgscore);
  19. }
  20. var curseries = [{
  21. name: "满分",
  22. type: "bar",
  23. barWidth: $.UnitUtil.mm2px(5),
  24. // 柱状图最小高度
  25. barMinHeight: $.UnitUtil.mm2px(2),
  26. barGap: 0,
  27. data: score,
  28. itemStyle: itemStyle
  29. },
  30. {
  31. name: "最高分",
  32. type: "bar",
  33. barWidth: $.UnitUtil.mm2px(5),
  34. // 柱状图最小高度
  35. barMinHeight: $.UnitUtil.mm2px(2),
  36. barGap: 0,
  37. data: maxscore,
  38. itemStyle: itemStyle
  39. },
  40. {
  41. name: "最低分",
  42. type: "bar",
  43. barWidth: $.UnitUtil.mm2px(5),
  44. // 柱状图最小高度
  45. barMinHeight: $.UnitUtil.mm2px(2),
  46. barGap: 0,
  47. data: minscore,
  48. itemStyle: itemStyle
  49. },
  50. {
  51. name: "平均分",
  52. type: "bar",
  53. barWidth: $.UnitUtil.mm2px(5),
  54. // 柱状图最小高度
  55. barMinHeight: $.UnitUtil.mm2px(2),
  56. barGap: 0,
  57. data: avgscore,
  58. itemStyle: itemStyle
  59. }
  60. ];
  61. var option = {
  62. animation: false,
  63. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  64. title: {
  65. text: "分",
  66. x: "left",
  67. y: "top",
  68. textStyle: {
  69. color: "#5F6E82",
  70. fontSize: $.UnitUtil.mm2px(3),
  71. fontWeight: 500
  72. }
  73. },
  74. legend: {
  75. itemWidth: $.UnitUtil.mm2px(2),
  76. itemHeight: $.UnitUtil.mm2px(2),
  77. top: "bottom",
  78. data: curlegend
  79. },
  80. grid: {
  81. top: $.UnitUtil.mm2px(10),
  82. left: 0,
  83. right: 0,
  84. bottom: $.UnitUtil.mm2px(8),
  85. containLabel: true,
  86. },
  87. xAxis: [{
  88. type: "category",
  89. data: xAxis_data,
  90. axisLabel: {
  91. color: "#5F6E82" //更改坐标轴文字颜色
  92. },
  93. axisTick: {
  94. alignWithLabel: true
  95. },
  96. boundaryGap: true,
  97. triggerEvent: true,
  98. axisLine: {
  99. show: true, //是否显示轴线
  100. lineStyle: {
  101. color: "#DADADA" //刻度线的颜色
  102. }
  103. }
  104. }],
  105. yAxis: [{
  106. type: "value",
  107. axisTick: {
  108. show: false //刻度
  109. },
  110. axisLine: {
  111. show: false, //是否显示轴线
  112. lineStyle: {
  113. color: "#DADADA" //刻度线的颜色
  114. }
  115. },
  116. splitLine: {
  117. //网格线
  118. lineStyle: {
  119. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  120. },
  121. show: true //隐藏或显示
  122. },
  123. axisLabel: {
  124. color: "#5F6E82" //更改坐标轴文字颜色
  125. }
  126. }],
  127. series: curseries
  128. };
  129. var myEcharts = echarts.init($(".section1 #averagescoreEcharts")[0]);
  130. myEcharts.clear();
  131. myEcharts.setOption(option);
  132. }
  133. function initExcellenceRateEcharts(list,xAxis_data) {
  134. var itemStyle = {
  135. normal: {
  136. label: {
  137. show: true, //开启显示数值
  138. position: "top" //数值在上方显示
  139. }
  140. }
  141. };
  142. var yxrate=[],lhrate=[],jgrate=[],dfrate=[];
  143. var curlegend = ["优秀率", "良好率", "及格率", "低分率"];
  144. for(var i=0;i<list.length;i++){
  145. var item = list[i];
  146. yxrate.push(item.yxrate);
  147. lhrate.push(item.lhrate);
  148. jgrate.push(item.jgrate);
  149. dfrate.push(item.dfrate);
  150. }
  151. var curseries = [
  152. {
  153. name: "优秀率",
  154. type: "bar",
  155. barWidth: $.UnitUtil.mm2px(5),
  156. // 柱状图最小高度
  157. barMinHeight: $.UnitUtil.mm2px(2),
  158. barGap: 0,
  159. data: yxrate,
  160. itemStyle: itemStyle
  161. },
  162. {
  163. name: "良好率",
  164. type: "bar",
  165. barWidth: $.UnitUtil.mm2px(5),
  166. // 柱状图最小高度
  167. barMinHeight: $.UnitUtil.mm2px(2),
  168. barGap: 0,
  169. data: lhrate,
  170. itemStyle: itemStyle
  171. },
  172. {
  173. name: "及格率",
  174. type: "bar",
  175. barWidth: $.UnitUtil.mm2px(5),
  176. // 柱状图最小高度
  177. barMinHeight: $.UnitUtil.mm2px(2),
  178. barGap: 0,
  179. data: jgrate,
  180. itemStyle: itemStyle
  181. },
  182. {
  183. name: "低分率",
  184. type: "bar",
  185. barWidth: $.UnitUtil.mm2px(5),
  186. // 柱状图最小高度
  187. barMinHeight: $.UnitUtil.mm2px(2),
  188. barGap: 0,
  189. data: dfrate,
  190. itemStyle: itemStyle
  191. }
  192. ];
  193. var option = {
  194. animation: false,
  195. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  196. title: {
  197. text: "分",
  198. x: "left",
  199. y: "top",
  200. textStyle: {
  201. color: "#5F6E82",
  202. fontSize: $.UnitUtil.mm2px(3),
  203. fontWeight: 500
  204. }
  205. },
  206. legend: {
  207. itemWidth: $.UnitUtil.mm2px(2),
  208. itemHeight: $.UnitUtil.mm2px(2),
  209. top: "bottom",
  210. data: curlegend
  211. },
  212. grid: {
  213. top: $.UnitUtil.mm2px(10),
  214. left: 0,
  215. right: 0,
  216. bottom: $.UnitUtil.mm2px(8),
  217. containLabel: true,
  218. },
  219. xAxis: [{
  220. type: "category",
  221. data: xAxis_data,
  222. axisLabel: {
  223. color: "#5F6E82" //更改坐标轴文字颜色
  224. },
  225. axisTick: {
  226. alignWithLabel: true
  227. },
  228. boundaryGap: true,
  229. triggerEvent: true,
  230. axisLine: {
  231. show: true, //是否显示轴线
  232. lineStyle: {
  233. color: "#DADADA" //刻度线的颜色
  234. }
  235. }
  236. }],
  237. yAxis: [{
  238. type: "value",
  239. axisTick: {
  240. show: false //刻度
  241. },
  242. axisLine: {
  243. show: false, //是否显示轴线
  244. lineStyle: {
  245. color: "#DADADA" //刻度线的颜色
  246. }
  247. },
  248. splitLine: {
  249. //网格线
  250. lineStyle: {
  251. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  252. },
  253. show: true //隐藏或显示
  254. },
  255. axisLabel: {
  256. color: "#5F6E82" //更改坐标轴文字颜色
  257. }
  258. }],
  259. series: curseries
  260. };
  261. var myEcharts = echarts.init($(".section1 #excellencerateEcharts")[0]);
  262. myEcharts.clear();
  263. myEcharts.setOption(option);
  264. }
  265. function initExamnumEcharts(list,xAxis_data) {
  266. var itemStyle = {
  267. normal: {
  268. label: {
  269. show: true, //开启显示数值
  270. position: "top" //数值在上方显示
  271. }
  272. }
  273. };
  274. var stunum = [],missnum=[];
  275. var curlegend = ["实考人数", "缺考人数"];
  276. for(var i=0;i<list.length;i++){
  277. var item = list[i];
  278. stunum.push(item.stunum);
  279. missnum.push(item.missnum);
  280. }
  281. var curseries = [{
  282. name: "实考人数",
  283. type: "bar",
  284. barWidth: $.UnitUtil.mm2px(5),
  285. // 柱状图最小高度
  286. barMinHeight: $.UnitUtil.mm2px(2),
  287. barGap: 0,
  288. data: stunum,
  289. itemStyle: itemStyle
  290. },
  291. {
  292. name: "缺考人数",
  293. type: "bar",
  294. barWidth: $.UnitUtil.mm2px(5),
  295. // 柱状图最小高度
  296. barMinHeight: $.UnitUtil.mm2px(2),
  297. barGap: 0,
  298. data: missnum,
  299. itemStyle: itemStyle
  300. }
  301. ];
  302. var option = {
  303. animation: false,
  304. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  305. title: {
  306. text: "分",
  307. x: "left",
  308. y: "top",
  309. textStyle: {
  310. color: "#5F6E82",
  311. fontSize: $.UnitUtil.mm2px(3),
  312. fontWeight: 500
  313. }
  314. },
  315. legend: {
  316. itemWidth: $.UnitUtil.mm2px(2),
  317. itemHeight: $.UnitUtil.mm2px(2),
  318. top: "bottom",
  319. data: curlegend
  320. },
  321. grid: {
  322. top: $.UnitUtil.mm2px(10),
  323. left: 0,
  324. right: 0,
  325. bottom: $.UnitUtil.mm2px(8),
  326. containLabel: true,
  327. },
  328. xAxis: [{
  329. type: "category",
  330. data: xAxis_data,
  331. axisLabel: {
  332. color: "#5F6E82" //更改坐标轴文字颜色
  333. },
  334. axisTick: {
  335. alignWithLabel: true
  336. },
  337. boundaryGap: true,
  338. triggerEvent: true,
  339. axisLine: {
  340. show: true, //是否显示轴线
  341. lineStyle: {
  342. color: "#DADADA" //刻度线的颜色
  343. }
  344. }
  345. }],
  346. yAxis: [{
  347. type: "value",
  348. axisTick: {
  349. show: false //刻度
  350. },
  351. axisLine: {
  352. show: false, //是否显示轴线
  353. lineStyle: {
  354. color: "#DADADA" //刻度线的颜色
  355. }
  356. },
  357. splitLine: {
  358. //网格线
  359. lineStyle: {
  360. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  361. },
  362. show: true //隐藏或显示
  363. },
  364. axisLabel: {
  365. color: "#5F6E82" //更改坐标轴文字颜色
  366. }
  367. }],
  368. series: curseries
  369. };
  370. var myEcharts = echarts.init($(".section1 #examnumEcharts")[0]);
  371. myEcharts.clear();
  372. myEcharts.setOption(option);
  373. }
  374. function initbzcEcharts(list,xAxis_data) {
  375. var itemStyle = {
  376. normal: {
  377. label: {
  378. show: true, //开启显示数值
  379. position: "top" //数值在上方显示
  380. }
  381. }
  382. };
  383. var bzc = [];
  384. var curlegend = ["标准差"];
  385. for(var i=0;i<list.length;i++){
  386. var item = list[i];
  387. bzc.push(item.bzc);
  388. }
  389. var curseries = [{
  390. name: "标准差",
  391. type: "bar",
  392. barWidth: $.UnitUtil.mm2px(5),
  393. // 柱状图最小高度
  394. barMinHeight: $.UnitUtil.mm2px(2),
  395. barGap: 0,
  396. data: bzc,
  397. itemStyle: itemStyle
  398. }];
  399. var option = {
  400. animation: false,
  401. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  402. title: {
  403. text: "分",
  404. x: "left",
  405. y: "top",
  406. textStyle: {
  407. color: "#5F6E82",
  408. fontSize: $.UnitUtil.mm2px(3),
  409. fontWeight: 500
  410. }
  411. },
  412. legend: {
  413. itemWidth: $.UnitUtil.mm2px(2),
  414. itemHeight: $.UnitUtil.mm2px(2),
  415. top: "bottom",
  416. data: curlegend
  417. },
  418. grid: {
  419. top: $.UnitUtil.mm2px(10),
  420. left: 0,
  421. right: 0,
  422. bottom: $.UnitUtil.mm2px(8),
  423. containLabel: true,
  424. },
  425. xAxis: [{
  426. type: "category",
  427. data: xAxis_data,
  428. axisLabel: {
  429. color: "#5F6E82" //更改坐标轴文字颜色
  430. },
  431. axisTick: {
  432. alignWithLabel: true
  433. },
  434. boundaryGap: true,
  435. triggerEvent: true,
  436. axisLine: {
  437. show: true, //是否显示轴线
  438. lineStyle: {
  439. color: "#DADADA" //刻度线的颜色
  440. }
  441. }
  442. }],
  443. yAxis: [{
  444. type: "value",
  445. axisTick: {
  446. show: false //刻度
  447. },
  448. axisLine: {
  449. show: false, //是否显示轴线
  450. lineStyle: {
  451. color: "#DADADA" //刻度线的颜色
  452. }
  453. },
  454. splitLine: {
  455. //网格线
  456. lineStyle: {
  457. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  458. },
  459. show: true //隐藏或显示
  460. },
  461. axisLabel: {
  462. color: "#5F6E82" //更改坐标轴文字颜色
  463. }
  464. }],
  465. series: curseries
  466. };
  467. var myEcharts = echarts.init($(".section1 #bzcEcharts")[0]);
  468. myEcharts.clear();
  469. myEcharts.setOption(option);
  470. }
  471. var parameter = JSON.parse($(".section_1_html_root").data("page-params"));
  472. $(".section1 .classnum").text(parameter.classnum);
  473. $(".section1 .stunum").text(parameter.stunum);
  474. $(".section1 .missnum").text(parameter.missnum);
  475. $(".section1 .subjectnum").text(parameter.subjectnum);
  476. $(".section1 .maxscore").text(parameter.maxscore);
  477. $(".section1 .avgscore").text(parameter.avgscore);
  478. $(".section1 .mixscore").text(parameter.mixscore);
  479. var xAxis_data = [],html = "";
  480. var mfclass = {
  481. num: 0,
  482. classname: ""
  483. },yxclass = {
  484. num: 0,
  485. classname: ""
  486. },jgclass = {
  487. num: 100,
  488. classname: ""
  489. },skclass = {
  490. num: 0,
  491. classname: ""
  492. },qkclass = {
  493. num: 0,
  494. classname: ""
  495. };
  496. for(var i=0;i<parameter.subjects.length;i++){
  497. var item = parameter.subjects[i];
  498. if(item.subjectname == "总分"){
  499. item.subjectname = "全部班级";
  500. }else{
  501. if (mfclass.num < item.score) {
  502. mfclass = {
  503. num: item.score,
  504. classname: item.subjectname
  505. };
  506. }
  507. if (yxclass.num < item.yxrate) {
  508. yxclass = {
  509. num: item.yxrate,
  510. classname: item.subjectname
  511. };
  512. }
  513. if (jgclass.num > item.jgrate) {
  514. jgclass = {
  515. num: item.jgrate,
  516. classname: item.subjectname
  517. };
  518. }
  519. if (skclass.num < item.stunum) {
  520. skclass = {
  521. num: item.stunum,
  522. classname: item.subjectname
  523. };
  524. }
  525. if (qkclass.num < item.missnum) {
  526. qkclass = {
  527. num: item.missnum,
  528. classname: item.subjectname
  529. };
  530. }
  531. html += '<tr><td><div class="my_cell">'+(item.subjectname ||0)+
  532. '</div></td><td><div class="my_cell">'+(item.stunum ||0)+
  533. '</div></td><td><div class="my_cell">'+(item.missnum ||0)+
  534. '</div></td><td><div class="my_cell">'+(item.score ||0)+
  535. '</div></td><td><div class="my_cell">'+(item.maxscore ||0)+
  536. '</div></td><td><div class="my_cell">'+(item.minscore ||0)+
  537. '</div></td><td><div class="my_cell">'+(item.avgscore ||0)+
  538. '</div></td><td><div class="my_cell">'+(item.yxrate ||0)+'%'+
  539. '</div></td><td><div class="my_cell">'+(item.lhrate ||0)+'%'+
  540. '</div></td><td><div class="my_cell">'+(item.jgrate ||0)+'%'+
  541. '</div></td><td><div class="my_cell">'+(item.dfrate ||0)+'%'+
  542. '</div></td><td><div class="my_cell">'+(item.bzc ||0)+
  543. '</div></td></tr>'
  544. }
  545. xAxis_data.push(item.subjectname);
  546. }
  547. $(".section1 .mfclass").text(mfclass.classname);
  548. $(".section1 .yxclass").text(yxclass.classname);
  549. $(".section1 .jgclass").text(jgclass.classname);
  550. $(".section1 .skclass").text(skclass.classname);
  551. $(".section1 .qkclass").text(qkclass.classname);
  552. $(".section1 .tbody").html(html);
  553. initAverageScoreEcharts(parameter.subjects,xAxis_data);
  554. initExcellenceRateEcharts(parameter.subjects,xAxis_data);
  555. initExamnumEcharts(parameter.subjects,xAxis_data);
  556. initbzcEcharts(parameter.subjects,xAxis_data);
  557. });