智慧校园考试-班级报告
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 35KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  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 = [],
  12. maxscore = [],
  13. minscore = [],
  14. avgscore = [];
  15. var curlegend = ["满分", "最高分", "最低分", "平均分"];
  16. for (var i = 0; i < list.length; i++) {
  17. var item = list[i];
  18. score.push(item.allscore);
  19. maxscore.push(item.classmaxscore);
  20. minscore.push(item.classminscore);
  21. avgscore.push(item.classavgscore);
  22. }
  23. var curseries = [
  24. {
  25. name: "满分",
  26. type: "bar",
  27. barWidth: $.UnitUtil.mm2px(5),
  28. // 柱状图最小高度
  29. barMinHeight: $.UnitUtil.mm2px(2),
  30. barGap: 0,
  31. data: score,
  32. itemStyle: itemStyle
  33. },
  34. {
  35. name: "最高分",
  36. type: "bar",
  37. barWidth: $.UnitUtil.mm2px(5),
  38. // 柱状图最小高度
  39. barMinHeight: $.UnitUtil.mm2px(2),
  40. barGap: 0,
  41. data: maxscore,
  42. itemStyle: itemStyle
  43. },
  44. {
  45. name: "最低分",
  46. type: "bar",
  47. barWidth: $.UnitUtil.mm2px(5),
  48. // 柱状图最小高度
  49. barMinHeight: $.UnitUtil.mm2px(2),
  50. barGap: 0,
  51. data: minscore,
  52. itemStyle: itemStyle
  53. },
  54. {
  55. name: "平均分",
  56. type: "bar",
  57. barWidth: $.UnitUtil.mm2px(5),
  58. // 柱状图最小高度
  59. barMinHeight: $.UnitUtil.mm2px(2),
  60. barGap: 0,
  61. data: avgscore,
  62. itemStyle: itemStyle
  63. }
  64. ];
  65. var option = {
  66. animation: false,
  67. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  68. title: {
  69. text: "分",
  70. x: "left",
  71. y: "top",
  72. textStyle: {
  73. color: "#5F6E82",
  74. fontSize: $.UnitUtil.mm2px(3),
  75. fontWeight: 500
  76. }
  77. },
  78. legend: {
  79. itemWidth: $.UnitUtil.mm2px(2),
  80. itemHeight: $.UnitUtil.mm2px(2),
  81. top: "bottom",
  82. data: curlegend
  83. },
  84. grid: {
  85. top: $.UnitUtil.mm2px(10),
  86. left: 0,
  87. right: 0,
  88. bottom: $.UnitUtil.mm2px(8),
  89. containLabel: true
  90. },
  91. xAxis: [
  92. {
  93. type: "category",
  94. data: xAxis_data,
  95. axisLabel: {
  96. color: "#5F6E82" //更改坐标轴文字颜色
  97. },
  98. axisTick: {
  99. alignWithLabel: true
  100. },
  101. boundaryGap: true,
  102. triggerEvent: true,
  103. axisLine: {
  104. show: true, //是否显示轴线
  105. lineStyle: {
  106. color: "#DADADA" //刻度线的颜色
  107. }
  108. }
  109. }
  110. ],
  111. yAxis: [
  112. {
  113. type: "value",
  114. axisTick: {
  115. show: false //刻度
  116. },
  117. axisLine: {
  118. show: false, //是否显示轴线
  119. lineStyle: {
  120. color: "#DADADA" //刻度线的颜色
  121. }
  122. },
  123. splitLine: {
  124. //网格线
  125. lineStyle: {
  126. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  127. },
  128. show: true //隐藏或显示
  129. },
  130. axisLabel: {
  131. color: "#5F6E82" //更改坐标轴文字颜色
  132. }
  133. }
  134. ],
  135. series: curseries
  136. };
  137. var myEcharts = echarts.init(
  138. document.querySelector(".section1 #averagescoreEcharts")
  139. );
  140. myEcharts.clear();
  141. myEcharts.setOption(option);
  142. }
  143. function initExcellenceRateEcharts(list, xAxis_data) {
  144. var itemStyle = {
  145. normal: {
  146. label: {
  147. show: true, //开启显示数值
  148. position: "top" //数值在上方显示
  149. }
  150. }
  151. };
  152. var yxrate = [],
  153. lhrate = [],
  154. jgrate = [],
  155. dfrate = [];
  156. var curlegend = ["优秀率", "良好率", "及格率", "低分率"];
  157. for (var i = 0; i < list.length; i++) {
  158. var item = list[i];
  159. yxrate.push(item.yxrate);
  160. lhrate.push(item.lhrate);
  161. jgrate.push(item.jgrate);
  162. dfrate.push(item.dfrate);
  163. }
  164. var curseries = [
  165. {
  166. name: "优秀率",
  167. type: "bar",
  168. barWidth: $.UnitUtil.mm2px(5),
  169. // 柱状图最小高度
  170. barMinHeight: $.UnitUtil.mm2px(2),
  171. barGap: 0,
  172. data: yxrate,
  173. itemStyle: itemStyle
  174. },
  175. {
  176. name: "良好率",
  177. type: "bar",
  178. barWidth: $.UnitUtil.mm2px(5),
  179. // 柱状图最小高度
  180. barMinHeight: $.UnitUtil.mm2px(2),
  181. barGap: 0,
  182. data: lhrate,
  183. itemStyle: itemStyle
  184. },
  185. {
  186. name: "及格率",
  187. type: "bar",
  188. barWidth: $.UnitUtil.mm2px(5),
  189. // 柱状图最小高度
  190. barMinHeight: $.UnitUtil.mm2px(2),
  191. barGap: 0,
  192. data: jgrate,
  193. itemStyle: itemStyle
  194. },
  195. {
  196. name: "低分率",
  197. type: "bar",
  198. barWidth: $.UnitUtil.mm2px(5),
  199. // 柱状图最小高度
  200. barMinHeight: $.UnitUtil.mm2px(2),
  201. barGap: 0,
  202. data: dfrate,
  203. itemStyle: itemStyle
  204. }
  205. ];
  206. var option = {
  207. animation: false,
  208. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  209. title: {
  210. text: "分",
  211. x: "left",
  212. y: "top",
  213. textStyle: {
  214. color: "#5F6E82",
  215. fontSize: $.UnitUtil.mm2px(3),
  216. fontWeight: 500
  217. }
  218. },
  219. legend: {
  220. itemWidth: $.UnitUtil.mm2px(2),
  221. itemHeight: $.UnitUtil.mm2px(2),
  222. top: "bottom",
  223. data: curlegend
  224. },
  225. grid: {
  226. top: $.UnitUtil.mm2px(10),
  227. left: 0,
  228. right: 0,
  229. bottom: $.UnitUtil.mm2px(8),
  230. containLabel: true
  231. },
  232. xAxis: [
  233. {
  234. type: "category",
  235. data: xAxis_data,
  236. axisLabel: {
  237. color: "#5F6E82" //更改坐标轴文字颜色
  238. },
  239. axisTick: {
  240. alignWithLabel: true
  241. },
  242. boundaryGap: true,
  243. triggerEvent: true,
  244. axisLine: {
  245. show: true, //是否显示轴线
  246. lineStyle: {
  247. color: "#DADADA" //刻度线的颜色
  248. }
  249. }
  250. }
  251. ],
  252. yAxis: [
  253. {
  254. type: "value",
  255. axisTick: {
  256. show: false //刻度
  257. },
  258. axisLine: {
  259. show: false, //是否显示轴线
  260. lineStyle: {
  261. color: "#DADADA" //刻度线的颜色
  262. }
  263. },
  264. splitLine: {
  265. //网格线
  266. lineStyle: {
  267. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  268. },
  269. show: true //隐藏或显示
  270. },
  271. axisLabel: {
  272. color: "#5F6E82" //更改坐标轴文字颜色
  273. }
  274. }
  275. ],
  276. series: curseries
  277. };
  278. var myEcharts = echarts.init(
  279. document.querySelector(".section1 #excellencerateEcharts")
  280. );
  281. myEcharts.clear();
  282. myEcharts.setOption(option);
  283. }
  284. function initExamnumEcharts(list, xAxis_data) {
  285. var itemStyle = {
  286. normal: {
  287. label: {
  288. show: true, //开启显示数值
  289. position: "top" //数值在上方显示
  290. }
  291. }
  292. };
  293. var stunum = [],
  294. missnum = [];
  295. var curlegend = ["实考人数", "缺考人数"];
  296. for (var i = 0; i < list.length; i++) {
  297. var item = list[i];
  298. stunum.push(item.stunum);
  299. missnum.push(item.missnum);
  300. }
  301. var curseries = [
  302. {
  303. name: "实考人数",
  304. type: "bar",
  305. barWidth: $.UnitUtil.mm2px(5),
  306. // 柱状图最小高度
  307. barMinHeight: $.UnitUtil.mm2px(2),
  308. barGap: 0,
  309. data: stunum,
  310. itemStyle: itemStyle
  311. },
  312. {
  313. name: "缺考人数",
  314. type: "bar",
  315. barWidth: $.UnitUtil.mm2px(5),
  316. // 柱状图最小高度
  317. barMinHeight: $.UnitUtil.mm2px(2),
  318. barGap: 0,
  319. data: missnum,
  320. itemStyle: itemStyle
  321. }
  322. ];
  323. var option = {
  324. animation: false,
  325. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  326. title: {
  327. text: "分",
  328. x: "left",
  329. y: "top",
  330. textStyle: {
  331. color: "#5F6E82",
  332. fontSize: $.UnitUtil.mm2px(3),
  333. fontWeight: 500
  334. }
  335. },
  336. legend: {
  337. itemWidth: $.UnitUtil.mm2px(2),
  338. itemHeight: $.UnitUtil.mm2px(2),
  339. top: "bottom",
  340. data: curlegend
  341. },
  342. grid: {
  343. top: $.UnitUtil.mm2px(10),
  344. left: 0,
  345. right: 0,
  346. bottom: $.UnitUtil.mm2px(8),
  347. containLabel: true
  348. },
  349. xAxis: [
  350. {
  351. type: "category",
  352. data: xAxis_data,
  353. axisLabel: {
  354. color: "#5F6E82" //更改坐标轴文字颜色
  355. },
  356. axisTick: {
  357. alignWithLabel: true
  358. },
  359. boundaryGap: true,
  360. triggerEvent: true,
  361. axisLine: {
  362. show: true, //是否显示轴线
  363. lineStyle: {
  364. color: "#DADADA" //刻度线的颜色
  365. }
  366. }
  367. }
  368. ],
  369. yAxis: [
  370. {
  371. type: "value",
  372. axisTick: {
  373. show: false //刻度
  374. },
  375. axisLine: {
  376. show: false, //是否显示轴线
  377. lineStyle: {
  378. color: "#DADADA" //刻度线的颜色
  379. }
  380. },
  381. splitLine: {
  382. //网格线
  383. lineStyle: {
  384. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  385. },
  386. show: true //隐藏或显示
  387. },
  388. axisLabel: {
  389. color: "#5F6E82" //更改坐标轴文字颜色
  390. }
  391. }
  392. ],
  393. series: curseries
  394. };
  395. var myEcharts = echarts.init(
  396. document.querySelector(".section1 #examnumEcharts")
  397. );
  398. myEcharts.clear();
  399. myEcharts.setOption(option);
  400. }
  401. function initbzcEcharts(list, xAxis_data) {
  402. var itemStyle = {
  403. normal: {
  404. label: {
  405. show: true, //开启显示数值
  406. position: "top" //数值在上方显示
  407. }
  408. }
  409. };
  410. var bzc = [];
  411. var curlegend = ["标准差"];
  412. for (var i = 0; i < list.length; i++) {
  413. var item = list[i];
  414. bzc.push(item.bzc);
  415. }
  416. var curseries = [
  417. {
  418. name: "标准差",
  419. type: "bar",
  420. barWidth: $.UnitUtil.mm2px(5),
  421. // 柱状图最小高度
  422. barMinHeight: $.UnitUtil.mm2px(2),
  423. barGap: 0,
  424. data: bzc,
  425. itemStyle: itemStyle
  426. }
  427. ];
  428. var option = {
  429. animation: false,
  430. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  431. title: {
  432. text: "分",
  433. x: "left",
  434. y: "top",
  435. textStyle: {
  436. color: "#5F6E82",
  437. fontSize: $.UnitUtil.mm2px(3),
  438. fontWeight: 500
  439. }
  440. },
  441. legend: {
  442. itemWidth: $.UnitUtil.mm2px(2),
  443. itemHeight: $.UnitUtil.mm2px(2),
  444. top: "bottom",
  445. data: curlegend
  446. },
  447. grid: {
  448. top: $.UnitUtil.mm2px(10),
  449. left: 0,
  450. right: 0,
  451. bottom: $.UnitUtil.mm2px(8),
  452. containLabel: true
  453. },
  454. xAxis: [
  455. {
  456. type: "category",
  457. data: xAxis_data,
  458. axisLabel: {
  459. color: "#5F6E82" //更改坐标轴文字颜色
  460. },
  461. axisTick: {
  462. alignWithLabel: true
  463. },
  464. boundaryGap: true,
  465. triggerEvent: true,
  466. axisLine: {
  467. show: true, //是否显示轴线
  468. lineStyle: {
  469. color: "#DADADA" //刻度线的颜色
  470. }
  471. }
  472. }
  473. ],
  474. yAxis: [
  475. {
  476. type: "value",
  477. axisTick: {
  478. show: false //刻度
  479. },
  480. axisLine: {
  481. show: false, //是否显示轴线
  482. lineStyle: {
  483. color: "#DADADA" //刻度线的颜色
  484. }
  485. },
  486. splitLine: {
  487. //网格线
  488. lineStyle: {
  489. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  490. },
  491. show: true //隐藏或显示
  492. },
  493. axisLabel: {
  494. color: "#5F6E82" //更改坐标轴文字颜色
  495. }
  496. }
  497. ],
  498. series: curseries
  499. };
  500. var myEcharts = echarts.init(
  501. document.querySelector(".section1 #bzcEcharts")
  502. );
  503. myEcharts.clear();
  504. myEcharts.setOption(option);
  505. }
  506. function initexamaverageEcharts(list, xAxis_data) {
  507. var itemStyle = {
  508. normal: {
  509. label: {
  510. show: true, //开启显示数值
  511. position: "top" //数值在上方显示
  512. }
  513. }
  514. };
  515. var stunum = [],
  516. missnum = [];
  517. var curlegend = ["平均分", "校平均分"];
  518. for (var i = 0; i < list.length; i++) {
  519. var item = list[i];
  520. stunum.push(item.classavgscore);
  521. missnum.push(item.schoolavgscore);
  522. }
  523. var curseries = [
  524. {
  525. name: "平均分",
  526. type: "bar",
  527. barWidth: $.UnitUtil.mm2px(5),
  528. // 柱状图最小高度
  529. barMinHeight: $.UnitUtil.mm2px(2),
  530. barGap: 0,
  531. data: stunum,
  532. itemStyle: itemStyle
  533. },
  534. {
  535. name: "校平均分",
  536. type: "bar",
  537. barWidth: $.UnitUtil.mm2px(5),
  538. // 柱状图最小高度
  539. barMinHeight: $.UnitUtil.mm2px(2),
  540. barGap: 0,
  541. data: missnum,
  542. itemStyle: itemStyle
  543. }
  544. ];
  545. var option = {
  546. animation: false,
  547. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  548. title: {
  549. text: "分",
  550. x: "left",
  551. y: "top",
  552. textStyle: {
  553. color: "#5F6E82",
  554. fontSize: $.UnitUtil.mm2px(3),
  555. fontWeight: 500
  556. }
  557. },
  558. legend: {
  559. itemWidth: $.UnitUtil.mm2px(2),
  560. itemHeight: $.UnitUtil.mm2px(2),
  561. top: "bottom",
  562. data: curlegend
  563. },
  564. grid: {
  565. top: $.UnitUtil.mm2px(10),
  566. left: 0,
  567. right: 0,
  568. bottom: $.UnitUtil.mm2px(8),
  569. containLabel: true
  570. },
  571. xAxis: [
  572. {
  573. type: "category",
  574. data: xAxis_data,
  575. axisLabel: {
  576. color: "#5F6E82" //更改坐标轴文字颜色
  577. },
  578. axisTick: {
  579. alignWithLabel: true
  580. },
  581. boundaryGap: true,
  582. triggerEvent: true,
  583. axisLine: {
  584. show: true, //是否显示轴线
  585. lineStyle: {
  586. color: "#DADADA" //刻度线的颜色
  587. }
  588. }
  589. }
  590. ],
  591. yAxis: [
  592. {
  593. type: "value",
  594. axisTick: {
  595. show: false //刻度
  596. },
  597. axisLine: {
  598. show: false, //是否显示轴线
  599. lineStyle: {
  600. color: "#DADADA" //刻度线的颜色
  601. }
  602. },
  603. splitLine: {
  604. //网格线
  605. lineStyle: {
  606. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  607. },
  608. show: true //隐藏或显示
  609. },
  610. axisLabel: {
  611. color: "#5F6E82" //更改坐标轴文字颜色
  612. }
  613. }
  614. ],
  615. series: curseries
  616. };
  617. var myEcharts = echarts.init(
  618. document.querySelector(".section1 #examaverageEcharts")
  619. );
  620. myEcharts.clear();
  621. myEcharts.setOption(option);
  622. }
  623. function initscoreGradeEcharts(list) {
  624. var xAxis_data = [],
  625. series_data = [],
  626. legend_data = [],
  627. levelRateObj = {},
  628. levelNumObj = {},
  629. levelrangeObj = [];
  630. $.each(list, function (key, item) {
  631. if (item.subjectname == "总分") {
  632. item.subjectname = "全科";
  633. }
  634. if ($.inArray(item.subjectname, xAxis_data) == -1) {
  635. xAxis_data.push(item.subjectname);
  636. }
  637. if ($.inArray(item.rankname + "类", legend_data) == -1) {
  638. legend_data.push(item.rankname + "类");
  639. }
  640. if ($.inArray(item.rankrange, levelrangeObj) == -1) {
  641. levelrangeObj.push(item.rankrange);
  642. }
  643. if (!levelRateObj[item.rankname + "类"]) {
  644. levelRateObj[item.rankname + "类"] = [];
  645. }
  646. levelRateObj[item.rankname + "类"].push(item.sturate);
  647. if (!levelNumObj[item.rankname + "类"]) {
  648. levelNumObj[item.rankname + "类"] = [];
  649. }
  650. levelNumObj[item.rankname + "类"].push(item.stunum);
  651. });
  652. $.each(legend_data, function (key, item) {
  653. series_data.push({
  654. name: item,
  655. type: "bar",
  656. stack: "总量",
  657. barWidth: 32,
  658. // 柱状图最小高度
  659. barMinHeight: 16,
  660. showBackground: true, // 柱状图显示背景
  661. backgroundStyle: {
  662. color: "#F3F4F5"
  663. },
  664. itemStyle: {
  665. normal: {
  666. barBorderRadius: [4, 4, 4, 4]
  667. }
  668. },
  669. label: {
  670. normal: {
  671. show: true,
  672. align: "center",
  673. verticalAlign: "middle",
  674. position: "inside",
  675. distance: 0,
  676. color: "#fff",
  677. formatter: function (params) {
  678. return levelNumObj[params.seriesName][params.dataIndex] || 0;
  679. }
  680. }
  681. },
  682. data: levelNumObj[item]
  683. });
  684. });
  685. showgraphicaldata(xAxis_data, legend_data, levelrangeObj, list);
  686. var option = {
  687. color: ["#5C99FF", "#ff5f56", "#5EC5C8", "#f1982b", "#6e5eff"],
  688. animation: false,
  689. title: {
  690. text: "%",
  691. x: "left",
  692. y: "top",
  693. textStyle: {
  694. color: "#5F6E82",
  695. fontSize: $.UnitUtil.mm2px(3),
  696. fontWeight: 500
  697. }
  698. },
  699. legend: {
  700. itemWidth: $.UnitUtil.mm2px(2),
  701. itemHeight: $.UnitUtil.mm2px(2),
  702. top: "bottom",
  703. data: legend_data
  704. },
  705. grid: {
  706. top: $.UnitUtil.mm2px(10),
  707. left: 0,
  708. right: 0,
  709. bottom: $.UnitUtil.mm2px(8),
  710. containLabel: true
  711. },
  712. xAxis: [
  713. {
  714. type: "category",
  715. data: xAxis_data,
  716. axisLabel: {
  717. color: "#5F6E82", //更改坐标轴文字颜色
  718. interval: 0
  719. },
  720. axisTick: {
  721. alignWithLabel: true
  722. },
  723. boundaryGap: true,
  724. triggerEvent: true,
  725. axisLine: {
  726. show: true, //是否显示轴线
  727. lineStyle: {
  728. color: "#DADADA" //刻度线的颜色
  729. }
  730. }
  731. }
  732. ],
  733. yAxis: [
  734. {
  735. type: "value",
  736. axisTick: {
  737. show: false //刻度
  738. },
  739. axisLine: {
  740. show: false, //是否显示轴线
  741. lineStyle: {
  742. color: "#DADADA" //刻度线的颜色
  743. }
  744. },
  745. splitLine: {
  746. //网格线
  747. lineStyle: {
  748. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  749. },
  750. show: true //隐藏或显示
  751. },
  752. axisLabel: {
  753. color: "#5F6E82" //更改坐标轴文字颜色
  754. }
  755. }
  756. ],
  757. series: series_data
  758. };
  759. var myEcharts = echarts.init(
  760. document.querySelector(".section1 #scoreGradeEcharts")
  761. );
  762. myEcharts.clear();
  763. myEcharts.setOption(option);
  764. }
  765. //图表数据
  766. function showgraphicaldata(xAxis_data, legend_data, levelrangeObj, list) {
  767. //图表数据
  768. var arr = JSON.parse(JSON.stringify(list));
  769. var tableobj = {};
  770. var tablehtml = "";
  771. $.each(xAxis_data, function (idx, item) {
  772. var classs = $.grep(arr, function (val) {
  773. return val.subjectname == item;
  774. });
  775. tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] =
  776. '<th rowspan="2">科目</th>';
  777. tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] = "";
  778. tableobj[classs[0].subjectname + "goodTableTbodyHtml"] = "";
  779. $.each(classs, function (idx, item) {
  780. tableobj[item.subjectname + "goodTableHeadTr1Html"] +=
  781. '<th colspan="2">' + item.rankname + "类" + item.rankrange + "</th>";
  782. tableobj[item.subjectname + "goodTableHeadTr2Html"] +=
  783. "<th>人数</th><th>比例</th>";
  784. if (idx == 0) {
  785. tableobj[item.subjectname + "goodTableTbodyHtml"] +=
  786. '<td><div class="my_cell">' + item.subjectname + "</div></td>";
  787. }
  788. tableobj[item.subjectname + "goodTableTbodyHtml"] +=
  789. '<td><div class="my_cell">' +
  790. item.stunum +
  791. '</div></td><td><div class="my_cell">' +
  792. item.sturate +
  793. "%</div></td>";
  794. });
  795. tablehtml +=
  796. ' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  797. tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] +
  798. '</tr><tr class="goodTableHeadTr2">' +
  799. tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] +
  800. '</tr></thead><tbody class="goodTableTbody">' +
  801. tableobj[classs[0].subjectname + "goodTableTbodyHtml"] +
  802. "</tbody></table>";
  803. });
  804. $(".section1 .gradescale").html(tablehtml);
  805. }
  806. function initclassscorePartEcharts(list) {
  807. var xAxis_data = [];
  808. var dataArr = [];
  809. var arr = $.grep(list, function (val) {
  810. return val.subjectid == "zf";
  811. });
  812. $.each(arr, function (index, item) {
  813. xAxis_data.push(item.rankname);
  814. dataArr.push(item.stunum);
  815. });
  816. var series_data = [
  817. {
  818. name: "全科",
  819. type: "line",
  820. symbol: "circle",
  821. stack: "全科",
  822. label: {
  823. normal: {
  824. show: true,
  825. align: "center",
  826. verticalAlign: "bottom",
  827. position: "top",
  828. distance: 0,
  829. formatter: `{c}`
  830. }
  831. },
  832. data: dataArr
  833. }
  834. ];
  835. var option = {
  836. animation: false,
  837. title: {
  838. text: "人",
  839. x: "left",
  840. y: "top",
  841. textStyle: {
  842. color: "#5F6E82",
  843. fontSize: $.UnitUtil.mm2px(3),
  844. fontWeight: 500
  845. }
  846. },
  847. color: ["#5C99FF", "#ff5f56", "#5EC5C8", "#f1982b", "#6e5eff"],
  848. legend: {
  849. icon: "roundRect",
  850. itemWidth: $.UnitUtil.mm2px(2),
  851. itemHeight: $.UnitUtil.mm2px(2),
  852. top: "bottom",
  853. data: ["全科"]
  854. },
  855. grid: {
  856. top: $.UnitUtil.mm2px(10),
  857. left: 0,
  858. right: 0,
  859. bottom: $.UnitUtil.mm2px(8),
  860. containLabel: true
  861. },
  862. xAxis: {
  863. type: "category",
  864. axisLabel: {
  865. textStyle: {
  866. color: "#5F6E82"
  867. },
  868. interval: 2,
  869. rotate: 0
  870. },
  871. axisTick: {
  872. show: false
  873. },
  874. data: xAxis_data
  875. },
  876. yAxis: {
  877. axisLabel: {
  878. textStyle: {
  879. color: "#9B9B9BFF"
  880. },
  881. interval: 0
  882. },
  883. minInterval: 1,
  884. axisLine: {
  885. show: false
  886. },
  887. axisTick: {
  888. show: false
  889. },
  890. splitLine: {
  891. //网格线
  892. lineStyle: {
  893. type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
  894. color: "#DADADA"
  895. },
  896. show: true //隐藏或显示
  897. },
  898. type: "value"
  899. },
  900. series: series_data
  901. };
  902. var myEcharts = echarts.init(
  903. document.querySelector(".section1 #classscorePartEcharts")
  904. );
  905. myEcharts.clear();
  906. myEcharts.setOption(option);
  907. showscoredistributiondata(list, xAxis_data, dataArr);
  908. }
  909. function showscoredistributiondata(list, xAxis_data) {
  910. var tableobj = {};
  911. var num = -1,
  912. rownum = 6; //一行六条数据
  913. $.each(xAxis_data, function (idx, item) {
  914. var obj = $.grep(list, function (val) {
  915. return val.rankname == item && val.subjectid == "zf";
  916. })[0];
  917. if ((idx + rownum) % rownum == 0) {
  918. num++;
  919. tableobj[num + "goodTableHeadTr1Html"] = '<th rowspan="2">科目</th>';
  920. tableobj[num + "goodTableHeadTr2Html"] = "";
  921. tableobj[num + "trHtml"] = '<td><div class="my_cell">全科</div></td>';
  922. }
  923. tableobj[num + "goodTableHeadTr1Html"] +=
  924. '<th colspan="2">' + item + "</th>";
  925. tableobj[num + "goodTableHeadTr2Html"] += "<th>人数</th><th>比例</th>";
  926. tableobj[num + "trHtml"] +=
  927. '<td><div class="my_cell">' +
  928. obj.stunum +
  929. '</div></td><td><div class="my_cell">' +
  930. obj.sturate +
  931. "%</div></td>";
  932. });
  933. //计算表格高度 页面高1047 剩余高度582 表头62.5 内容27.42
  934. var tableheight = (27.5 + 62.5 + 15) * (num + 1);
  935. var page = {
  936. 1: "",
  937. 2: "",
  938. 3: ""
  939. }; //页数
  940. var table = "";
  941. var itemheight = 27.5 + 62.5 + 15; //单表高度
  942. var maxheight = 0;
  943. for (var i = 0; i < num + 1; i++) {
  944. maxheight = itemheight * (i + 1);
  945. var content =
  946. ' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  947. tableobj[i + "goodTableHeadTr1Html"] +
  948. '</tr><tr class="goodTableHeadTr2">' +
  949. tableobj[i + "goodTableHeadTr2Html"] +
  950. '</tr></thead><tbody class="goodTableTbody">' +
  951. tableobj[i + "trHtml"] +
  952. "</tbody></table>";
  953. //计算剩余高度是否能显示最后一个表格
  954. if (maxheight > 582 && 582 - maxheight < itemheight) {
  955. page[1] += content;
  956. } else if (maxheight > 1629 && 1629 - maxheight < itemheight) {
  957. page[2] += content;
  958. } else {
  959. table += content;
  960. }
  961. }
  962. $(".table_num0 .scoredistribution").html(table);
  963. if (tableheight > 582) {
  964. //添加第一页
  965. $(".table_num0").after(
  966. '<div class="page_root section_2_part table_num1"></div>'
  967. );
  968. $(".table_num1").html(page[1]);
  969. } else if (tableheight > 1629) {
  970. //添加第二页
  971. $(".table_num1").after(
  972. '<div class="page_root section_2_part table_num2"></div>'
  973. );
  974. $(".table_num2").html(page[2]);
  975. }
  976. }
  977. function initgoodbadSubjectEcharts(list) {
  978. var schoolrate = [],
  979. classrate = [],
  980. legendlist = [ "全年级",list[0].classname];
  981. $.each(list, function (idx, item) {
  982. if (item.subjectname != "全科") {
  983. classrate.push(
  984. parseInt(
  985. ((item.classavgscore - item.schoolavgscore) / item.bzc) * 10000
  986. ) / 100 || 0
  987. );
  988. schoolrate.push(
  989. parseInt((item.classavgscore / item.schoolavgscore) * 10000) / 100 || 0
  990. );
  991. }
  992. });
  993. // 求出数组最大值
  994. let arr = [...schoolrate, ...classrate],yssubject = "",lssubject = "";
  995. let arr1 = Math.max.apply(null, arr);
  996. let maxnum = parseInt((arr1 + 10) / 10) * 10;
  997. let arrList = [];
  998. $.each(list, function (idx, item) {
  999. if (item.subjectname != "全科") {
  1000. let j = {
  1001. name: item.subjectname,
  1002. max: maxnum
  1003. };
  1004. arrList.push(j);
  1005. if (item.bzc > item.qkbzc) {
  1006. yssubject += item.subjectname + "、";
  1007. } else {
  1008. lssubject += item.subjectname + "、";
  1009. }
  1010. }
  1011. });
  1012. yssubject = yssubject.substr(0, yssubject.length - 1);
  1013. lssubject = lssubject.substr(0, lssubject.length - 1);
  1014. $(".section1 .yssubject").text(yssubject); // 优势
  1015. $(".section1 .lssubject").text(lssubject); // 劣势
  1016. var option = {
  1017. animation: false,
  1018. color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
  1019. legend: {
  1020. icon: "rectRound",
  1021. itemWidth: $.UnitUtil.mm2px(2),
  1022. itemHeight: $.UnitUtil.mm2px(2),
  1023. data: legendlist,
  1024. x: "center",
  1025. y: "bottom"
  1026. },
  1027. grid: {
  1028. top: $.UnitUtil.mm2px(10),
  1029. left: 0,
  1030. right: 0,
  1031. bottom: $.UnitUtil.mm2px(8),
  1032. containLabel: true
  1033. },
  1034. radar: {
  1035. radius: "60%",
  1036. center: ["50%", "55%"],
  1037. indicator: arrList
  1038. },
  1039. series: {
  1040. type: "radar",
  1041. tooltip: {
  1042. trigger: "item"
  1043. },
  1044. // areaStyle: {}, //内部阴影
  1045. data: [
  1046. {
  1047. value: schoolrate,
  1048. label: {
  1049. show: true,
  1050. formatter: function (params) {
  1051. return params.value;
  1052. }
  1053. },
  1054. name: "全年级"
  1055. },
  1056. {
  1057. value: classrate,
  1058. label: {
  1059. show: true,
  1060. formatter: function (params) {
  1061. return params.value;
  1062. }
  1063. },
  1064. name: list[0].classname
  1065. }
  1066. ]
  1067. }
  1068. };
  1069. var myEcharts = echarts.init(
  1070. document.querySelector(".section1 #goodbadSubjectEcharts")
  1071. );
  1072. myEcharts.clear();
  1073. myEcharts.setOption(option);
  1074. showgoodbadtable(list,legendlist,schoolrate,classrate);
  1075. }
  1076. function showgoodbadtable (list, legendlist, schoolrate, classrate) {
  1077. var table = "", goodTableHeadTr1Html = '<th >班级</th>', goodTableHeadTr2Html = "", trHtml = "";
  1078. $.each(list, function (idx, item) {
  1079. if (item.subjectname != "全科") {
  1080. goodTableHeadTr1Html += '<th>' + item.subjectname + "</th>";
  1081. }
  1082. })
  1083. $.each(legendlist, function (idx, item) {
  1084. trHtml += '<tr><th>' + item + "</th>";
  1085. if (idx == 0) {
  1086. $.each(schoolrate, function (idx, item) {
  1087. trHtml += '<th>' + item + "%</th>";
  1088. })
  1089. } else {
  1090. $.each(classrate, function (idx, item) {
  1091. trHtml += '<th>' + item + "%</th>";
  1092. })
  1093. }
  1094. })
  1095. table = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  1096. goodTableHeadTr1Html + '</tr></thead><tbody class="goodTableTbody">' +
  1097. trHtml + '</tbody></table>'
  1098. $(".section1 .goodbadtable").html(table);
  1099. }
  1100. var parameter = JSON.parse($(".section_1_html_root").data("page-params"));
  1101. var xAxis_data = [],
  1102. html = "";
  1103. var mfclass = {
  1104. num: 0,
  1105. classname: ""
  1106. },
  1107. yxclass = {
  1108. num: 0,
  1109. classname: ""
  1110. },
  1111. lhclass = {
  1112. num: 0,
  1113. classname: ""
  1114. },
  1115. jgclass = {
  1116. num: 0,
  1117. classname: ""
  1118. },
  1119. dfclass = {
  1120. num: 0,
  1121. classname: ""
  1122. },
  1123. skclass = {
  1124. num: 0,
  1125. classname: ""
  1126. },
  1127. qkclass = {
  1128. num: 0,
  1129. classname: ""
  1130. },
  1131. goodclass = {
  1132. num: 0,
  1133. classname: ""
  1134. },
  1135. badclass = {
  1136. num: 0,
  1137. classname: ""
  1138. };
  1139. for (var i = 0; i < parameter.xkcj.length; i++) {
  1140. var item = parameter.xkcj[i];
  1141. if (item.subjectname == "总分") {
  1142. item.subjectname = "全科";
  1143. } else {
  1144. if (mfclass.num < item.allscore) {
  1145. mfclass = {
  1146. num: item.allscore,
  1147. classname: item.subjectname
  1148. };
  1149. }
  1150. if (yxclass.num < item.yxrate) {
  1151. yxclass = {
  1152. num: item.yxrate,
  1153. classname: item.subjectname
  1154. };
  1155. }
  1156. if (lhclass.num < item.lhrate) {
  1157. lhclass = {
  1158. num: item.lhrate,
  1159. classname: item.subjectname
  1160. };
  1161. }
  1162. if (jgclass.num < item.jgrate) {
  1163. jgclass = {
  1164. num: item.jgrate,
  1165. classname: item.subjectname
  1166. };
  1167. }
  1168. if (dfclass.num < item.dfrate) {
  1169. dfclass = {
  1170. num: item.dfrate,
  1171. classname: item.subjectname
  1172. };
  1173. }
  1174. if (skclass.num < item.stunum) {
  1175. skclass = {
  1176. num: item.stunum,
  1177. classname: item.subjectname
  1178. };
  1179. }
  1180. if (qkclass.num < item.missnum) {
  1181. qkclass = {
  1182. num: item.missnum,
  1183. classname: item.subjectname
  1184. };
  1185. }
  1186. if (item.bzc > item.qkbzc) {
  1187. goodclass.classname += item.subjectname + "、";
  1188. } else {
  1189. badclass.classname += item.subjectname + "、";
  1190. }
  1191. }
  1192. html +=
  1193. '<tr><td><div class="my_cell">' +
  1194. (item.subjectname || 0) +
  1195. '</div></td><td><div class="my_cell">' +
  1196. (item.stunum || 0) +
  1197. '</div></td><td><div class="my_cell">' +
  1198. (item.missnum || 0) +
  1199. '</div></td><td><div class="my_cell">' +
  1200. (item.score || 0) +
  1201. '</div></td><td><div class="my_cell">' +
  1202. (item.maxscore || 0) +
  1203. '</div></td><td><div class="my_cell">' +
  1204. (item.minscore || 0) +
  1205. '</div></td><td><div class="my_cell">' +
  1206. (item.avgscore || 0) +
  1207. '</div></td><td><div class="my_cell">' +
  1208. (item.yxrate || 0) +
  1209. "%" +
  1210. '</div></td><td><div class="my_cell">' +
  1211. (item.lhrate || 0) +
  1212. "%" +
  1213. '</div></td><td><div class="my_cell">' +
  1214. (item.jgrate || 0) +
  1215. "%" +
  1216. '</div></td><td><div class="my_cell">' +
  1217. (item.dfrate || 0) +
  1218. "%" +
  1219. '</div></td><td><div class="my_cell">' +
  1220. (item.bzc || 0) +
  1221. "%</div></td></tr>";
  1222. xAxis_data.push(item.subjectname);
  1223. }
  1224. goodclass.classname = goodclass.classname.substr(
  1225. 0,
  1226. goodclass.classname.length - 1
  1227. );
  1228. badclass.classname = badclass.classname.substr(
  1229. 0,
  1230. badclass.classname.length - 1
  1231. );
  1232. console.log(parameter);
  1233. $(".section1 .mfclass").text(mfclass.classname); //满分
  1234. $(".section1 .yxclass").text(yxclass.classname); //优秀
  1235. $(".section1 .lhclass").text(lhclass.classname); //良好
  1236. $(".section1 .jgclass").text(jgclass.classname); //及格
  1237. $(".section1 .dfclass").text(dfclass.classname); //低分
  1238. $(".section1 .skclass").text(skclass.classname); //实考
  1239. $(".section1 .qkclass").text(qkclass.classname); // 缺考
  1240. $(".section1 .goodclass").text(goodclass.classname); //较好
  1241. $(".section1 .badclass").text(badclass.classname); // 较差
  1242. $(".section1 .tbody").html(html); //学科成绩整体分析
  1243. initAverageScoreEcharts(parameter.xkcj, xAxis_data);
  1244. initExcellenceRateEcharts(parameter.xkcj, xAxis_data);
  1245. initExamnumEcharts(parameter.xkcj, xAxis_data);
  1246. initbzcEcharts(parameter.xkcj, xAxis_data);
  1247. initexamaverageEcharts(parameter.xkcj, xAxis_data);
  1248. initscoreGradeEcharts(parameter.fsdjtj, xAxis_data);
  1249. initclassscorePartEcharts(parameter.fsdtj);
  1250. initgoodbadSubjectEcharts(parameter.xkcj);
  1251. // document.documentElement.scrollTop = 6200;
  1252. });