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

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