score.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. function toggleHide() {
  2. $(".hidable").toggle();
  3. };
  4. AV.init({
  5. appId: "BmologYYnRqCv0SLHDeDdA17-gzGzoHsz",
  6. appKey: "w9mVebFMdCmY6Nh9vfcBGaGt",
  7. serverURL: "https://bmologyy.lc-cn-n1-shared.com/",
  8. });
  9. console.log("温馨提示:*成绩*一定不会上传到网络,但为了保证使用范围,可能会对其他信息进行记录。")
  10. function decimal(x, n) {
  11. x = Math.round(x * 10 ** n) / 10 ** n;
  12. return x.toFixed(n);
  13. }
  14. var fileCount = 0, cur = 0, files = {};
  15. function prevFile() {
  16. cur = (cur - 1 + fileCount) % fileCount;
  17. processFiles();
  18. }
  19. function nextFile() {
  20. cur = (cur + 1) % fileCount;
  21. processFiles();
  22. }
  23. function clearScreen() {
  24. $(".chart").hide()
  25. $("#fileOutput")[0].innerHTML = "";
  26. $("#fileInfo")[0].innerHTML = "";
  27. $("#name")[0].innerHTML = "";
  28. }
  29. function reset() {
  30. cur = 0;
  31. fileCount = 0;
  32. files = {};
  33. clearScreen();
  34. $("#message")[0].innerHTML = "";
  35. $("#controls").addClass("disabled");
  36. $("#lbtn").addClass("disabled");
  37. $("#rbtn").addClass("disabled");
  38. $("#resetbtn").addClass("disabled");
  39. $("#upbtn").removeClass('btn-danger');
  40. $("#upbtn").addClass('btn-info');
  41. $("#upicon").removeClass('glyphicon-exclamation-sign');
  42. $("#upicon").addClass('glyphicon-open');
  43. }
  44. document.onkeydown = function (event) {
  45. var e = event || window.event || arguments.callee.caller.arguments[0];
  46. if (e) {
  47. if (e.key == "ArrowLeft") {
  48. prevFile();
  49. }
  50. else if (e.key == "ArrowRight") {
  51. nextFile();
  52. } else if ('1' <= e.key && e.key <= '9') {
  53. if (parseInt(e.key) <= fileCount) {
  54. cur = parseInt(e.key) - 1;
  55. processFiles();
  56. }
  57. }
  58. }
  59. };
  60. function getFiles(event) {
  61. files[fileCount] = event.target.files[0];
  62. cur = fileCount;
  63. fileCount++;
  64. $("#controls").removeClass("disabled");
  65. $("#lbtn").removeClass("disabled");
  66. $("#rbtn").removeClass("disabled");
  67. $("#resetbtn").removeClass("disabled");
  68. processFiles(1);
  69. }
  70. const key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
  71. function aesDecrypt(encrypted) {
  72. var encryptedHexStr = CryptoJS.enc.Hex.parse(encrypted);
  73. var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(encrypted) })
  74. var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
  75. var decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
  76. return decryptedStr;
  77. }
  78. function processFiles(isFirstTime = 0) {
  79. console.log("Start processing No. " + cur);
  80. var file = files[cur];
  81. var message = $("#message")[0];
  82. var upBtn = $("#upbtn")[0];
  83. var upIcon = $("#upicon")[0];
  84. var tableLayout = '<table class="table table-responsive" style="table-layout: fixed;">'
  85. message.innerHTML = (cur + 1) + "/" + (fileCount) + " - " + file.name + " - " + file.size + " 字节 - " + file.type + " - 正在读取...<br>>";
  86. upBtn.classList.remove('btn-danger');
  87. upBtn.classList.add('btn-info');
  88. upIcon.classList.remove('glyphicon-exclamation-sign');
  89. upIcon.classList.add('glyphicon-open');
  90. var reader = new FileReader();
  91. var content = "";
  92. reader.onload = function (event) {
  93. try {
  94. var output = $("#fileOutput")[0];
  95. var info = $("#fileInfo")[0];
  96. var name = $("#name")[0];
  97. var object = eval("(" + event.target.result + ")");
  98. var classText = "", gradingText = "";
  99. object.data = eval("(" + aesDecrypt(object.data).toString() + ")");
  100. var seIds = [], seNames = [], iter = 1;
  101. var datSingle = object.data.multiExamStudentScore.singleExamStudentScores, datClass = object.data.singleExamClassScores, datYs = object.data.singleExamClassYsScores, datMulti = object.data.multiExam.singleExams;
  102. seIds = object.data.seIds;
  103. for (var i = 0; i < seIds.length; i++) {
  104. console.log(datMulti[i].seId)
  105. for (var j = 0; j < seIds.length; j++) {
  106. if (datMulti[i].seId == seIds[j]) {
  107. seNames[j] = datMulti[i].seCourseName;
  108. }
  109. }
  110. }
  111. console.log(seIds)
  112. console.log(seNames)
  113. var seNameDic = {};
  114. for (var i = 0; i < seIds.length; i++) {
  115. seNameDic[seIds[i]] = seNames[i];
  116. }
  117. seNameDic["0"] = "总分";
  118. for (var i = 0; i < datYs.length; i++) {
  119. seNameDic[datYs[i].seId + "Ys"] = seNameDic[datYs[i].seId] + " " + datYs[i].ysClassId;
  120. }
  121. console.log(seNameDic)
  122. var seIdDic = {}, seIdRev = {};
  123. for (var i = 0; i < seIds.length; i++) {
  124. for (var j = 0; j < seIds.length; j++) {
  125. if (datSingle[j].seId == seIds[i]) {
  126. seIdDic[j] = i;
  127. }
  128. }
  129. }
  130. for (var i = 0; i < seIds.length; i++)seIdRev[seIdDic[i]] = i;
  131. var scoreP = {}, avgP = {}, rate0 = {}, rate25 = {}, rate50 = {}, rate75 = {}, rate100 = {}, rateFull = {};//表1用
  132. var classOrderP = {}, ysClassOrderP = {}, gradeOrderP = {};
  133. var classOrder = {}, ysClassOrder = {}, gradeOrder = {};
  134. for (var i = 0; i < seIds.length; i++) {
  135. var dId = datSingle[i].seId;
  136. scoreP[dId] = datSingle[i].essScore;
  137. avgP[dId] = datClass[i].secsAvgScore;
  138. rate0[dId] = datClass[i].secsMinScore;
  139. rate25[dId] = datClass[i].secsQuarterScore;
  140. rate50[dId] = datClass[i].secsHalfScore;
  141. rate75[dId] = datClass[i].secs3quatrerScore;
  142. rate100[dId] = datClass[i].secsMaxScore;
  143. rateFull[dId] = datMulti[seIdDic[i]].seFullScore;
  144. // scoreRate[dId] = decimal(datSingle[i].essScore / datMulti[seIdDic[i]].seFullScore, 3);
  145. classOrderP[dId] = datSingle[i].essClassOrder;
  146. gradeOrderP[dId] = datSingle[i].essGradeOrder;
  147. classOrder[dId] = decimal(1 - datSingle[i].essClassOrder / datClass[i].secsStudentCount, 3);
  148. gradeOrder[dId] = decimal(1 - datSingle[i].essGradeOrder / datMulti[seIdDic[i]].seStudentCount, 3);
  149. }
  150. // scoreRate["0"] = decimal(object.data.multiExamStudentScore.messScore / object.data.multiExam.meFullScore, 3);
  151. // classOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messClassOrder / object.data.multiExamClassScores[0].mecsStudentCount, 3); + "<br>"
  152. // gradeOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messGradeOrder / object.data.multiExamSchoolScore.mecsStudentCount, 3); + "<br>"
  153. classOrderP["0"] = object.data.multiExamStudentScore.messClassOrder;
  154. gradeOrderP["0"] = object.data.multiExamStudentScore.messGradeOrder
  155. for (var i = 0; i < datYs.length; i++) {
  156. for (var j = 0; j < seIds.length; j++) {
  157. if (datYs[i].seId == datSingle[j].seId) {
  158. ysClassOrder[datYs[i].seId + "Ys"] = decimal(1 - datSingle[j].essYsClassOrder / datYs[i].secsStudentCount, 3);
  159. ysClassOrderP[datYs[i].seId + "Ys"] = datSingle[j].essYsClassOrder;
  160. }
  161. }
  162. }
  163. for (var i = 0; i < seIds.length; i++) {
  164. // object.data.multiExamStudentScore.singleExamStudentScores[i].seId ---datSingle
  165. // object.data.singleExamClassScores[i].seId ---datClass
  166. // object.data.multiExam.singleExams[i].seId ---datMulti
  167. // seIds[i]
  168. // 前两个和后两个数据应该是能分别对上号的(1-2 3-4),用 seIdDic 连接
  169. // seIdDic {key(1-2): value(3-4),..}
  170. var g = seIdRev[i];
  171. classText += "<h4>"
  172. + seNameDic[datSingle[g].seId] + "</h4>"
  173. + "<b>单科分数:" + datSingle[g].essScore + "</b><br><br>"
  174. + "单科分数班级排名:" + datSingle[g].essClassOrder + "<br>"
  175. + "单科班级参考人数:" + datClass[g].secsStudentCount + "<br>"
  176. + "单科班级年级排名:" + datClass[g].secsClassOrder + "<br>"
  177. + "单科班级:"
  178. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  179. + "<tr><td>" + datClass[g].secsAvgScore + "</td><td>" + datClass[g].secsMaxScore + "</td><td>" + datClass[g].secs3quatrerScore + "</td><td>" + datClass[g].secsHalfScore + "</td><td>" + datClass[g].secsQuarterScore + "</td><td>" + datClass[g].secsMinScore + "</td></tr></table>";
  180. for (var j = 0; j < datYs.length; j++) {
  181. if (datYs[j].seId == datSingle[g].seId) {
  182. classText += "<br><br>"
  183. + "单科分层班级名称:" + datYs[j].ysClassId + "<br>"
  184. + "单科分数分层班级排名:" + datSingle[g].essYsClassOrder + "<br>"
  185. + "单科分层班级参考人数:" + datYs[j].secsStudentCount + "<br>"
  186. + "单科分层班级年级排名:" + datYs[j].secsClassOrder + "<br>"
  187. + "单科分层班级:"
  188. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  189. + "<tr><td>" + datYs[j].secsAvgScore + "</td><td>" + datYs[j].secsMaxScore + "</td><td>" + datYs[j].secs3quatrerScore + "</td><td>" + datYs[j].secsHalfScore + "</td><td>" + datYs[j].secsQuarterScore + "</td><td>" + datYs[j].secsMinScore + "</td></tr></table>";
  190. }
  191. }
  192. classText += "<br><br>"
  193. + "单科分数年级排名:" + datSingle[g].essGradeOrder + "<br>"
  194. + "单科年级参考人数:" + datMulti[seIdDic[g]].seStudentCount + "<br>"
  195. + "单科年级:"
  196. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  197. + "<tr><td>" + datMulti[seIdDic[g]].seAvgScore + "</td><td>" + datMulti[seIdDic[g]].seMaxScore + "</td><td>" + datMulti[seIdDic[g]].se3QuarterScore + "</td><td>" + datMulti[seIdDic[g]].seHalfScore + "</td><td>" + datMulti[seIdDic[g]].seQuarterScore + "</td><td>" + datMulti[seIdDic[g]].seMinScore + "</td></tr></table><br><br>";
  198. }
  199. } catch (e) {
  200. console.log(e);
  201. clearScreen();
  202. message.innerHTML += "读取失败!";
  203. upBtn.classList.remove('btn-info');
  204. upBtn.classList.add('btn-danger');
  205. upIcon.classList.remove('glyphicon-open');
  206. upIcon.classList.add('glyphicon-exclamation-sign');
  207. return;
  208. }
  209. // sheetOutput("各科得分比例一览表", scoreRate);
  210. // sheetOutput("各科班级排名一览表", classOrder);
  211. // sheetOutput("各科分层班级排名一览表", ysClassOrder);
  212. // sheetOutput("各科年级排名一览表", gradeOrder);
  213. if (isFirstTime) {
  214. const up = AV.Object.extend('Score');
  215. const upload = new up();
  216. upload.set('name', object.data.multiExamStudentScore.studentName);
  217. upload.set('classId', parseInt(object.data.examStudents[0].classId));
  218. upload.save().then((upload) => {
  219. console.log("success" + upload);
  220. });
  221. }
  222. message.innerHTML += "读取成功!"
  223. + " - 注:实验中学 74 桌出品,我仅做搬运修改。<br>";
  224. name.innerHTML = "姓名:" + object.data.multiExamStudentScore.studentName;
  225. info.innerHTML = "<h3>" + object.data.multiExam.meName + "</h3>"
  226. + "行政班级:" + object.data.examStudents[0].classId + "<br>"
  227. + "姓名:" + object.data.multiExamStudentScore.studentName + "<br>"
  228. + "<br><h4>班内一览表</h4>";
  229. output.innerHTML = "<br><h4>总分</h4>"
  230. + "<b>全科分数:" + object.data.multiExamStudentScore.messScore + "</b><br><br>"
  231. + "全科分数班级排名:" + object.data.multiExamStudentScore.messClassOrder + "<br>"
  232. + "全科班级参考人数:" + object.data.multiExamClassScores[0].mecsStudentCount + "<br>"
  233. + "全科班级年级排名:" + object.data.multiExamClassScores[0].mecsClassOrder + "<br>"
  234. + "全科班级:"
  235. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  236. + "<tr><td>" + object.data.multiExamClassScores[0].mecsAvgScore + "</td><td>" + object.data.multiExamClassScores[0].mecsMaxScore + "</td><td>" + object.data.multiExamClassScores[0].mecs3quatrerScore + "</td><td>" + object.data.multiExamClassScores[0].mecsHalfScore + "</td><td>" + object.data.multiExamClassScores[0].mecsQuarterScore + "</td><td>" + object.data.multiExamClassScores[0].mecsMinScore + "</td></tr></table>"
  237. + "<br><br>全科分数年级排名:" + object.data.multiExamStudentScore.messGradeOrder + "<br>"
  238. + "全科年级参考人数:" + object.data.multiExamSchoolScore.mecsStudentCount + "<br>"
  239. + "全科年级:"
  240. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  241. + "<tr><td>" + object.data.multiExam.meAvgScore + "</td><td>" + object.data.multiExam.meMaxScore + "</td><td>" + object.data.multiExam.me3QuatrerScore + "</td><td>" + object.data.multiExam.meHalfScore + "</td><td>" + object.data.multiExam.meQuarterScore + "</td><td>" + object.data.multiExam.meMinScore + "</td></tr></table><br><br>"
  242. + classText
  243. + "<h4>排名汇总</h4>";
  244. $("#fileOutput table").css("display", "inline-table");
  245. $("#fileOutput table").css("margin-bottom", "0px");
  246. $('.chart').show();
  247. sChart1 = echarts.init($("#score1")[0]);
  248. sChart2 = echarts.init($("#score2")[0]);
  249. oChart1 = echarts.init($("#order1")[0]);
  250. oChart2 = echarts.init($("#order2")[0]);
  251. oChart3 = echarts.init($("#order3")[0]);
  252. oChart4 = echarts.init($("#order4")[0]);
  253. seNameDicP = []; scorePP = []; avgPP = []; rate0P = []; rate25P = []; rate50P = []; rate75P = []; rate100P = []; rateFullP = [];
  254. scoreQ = []; avgQ = []; rate0Q = []; rate25Q = []; rate50Q = []; rate75Q = []; rate100Q = [];
  255. seNameDicP2 = []; classOrderPP = []; gradeOrderPP = []; classOrderQ = []; gradeOrderQ = [];
  256. seNameDicP3 = []; ysClassOrderPP = []; ysClassOrderQ = [];
  257. console.log(scoreP)
  258. for (var i = 0; i < seIds.length; i++) {
  259. var g = seIds[i];
  260. if (seNameDic[g].substr(0, 2) == '总分') continue;
  261. seNameDicP.push(seNameDic[g].substr(0, 2));
  262. scorePP.push(scoreP[g]);
  263. avgPP.push(avgP[g]);
  264. rate0P.push(rate0[g]);
  265. rate25P.push(rate25[g]);
  266. rate50P.push(rate50[g]);
  267. rate75P.push(rate75[g]);
  268. rate100P.push(rate100[g]);
  269. rateFullP.push(rateFull[g]);
  270. scoreQ.push(decimal(scoreP[g] / rateFull[g] * 100, 1));
  271. avgQ.push(decimal(avgP[g] / rateFull[g] * 100, 1));
  272. rate0Q.push(decimal(rate0[g] / rateFull[g] * 100, 1));
  273. rate25Q.push(decimal(rate25[g] / rateFull[g] * 100, 1));
  274. rate50Q.push(decimal(rate50[g] / rateFull[g] * 100, 1));
  275. rate75Q.push(decimal(rate75[g] / rateFull[g] * 100, 1));
  276. rate100Q.push(decimal(rate100[g] / rateFull[g] * 100, 1));
  277. }
  278. for (var i = 0; i < seIds.length; i++) {
  279. var g = seIds[i];
  280. seNameDicP2.push(seNameDic[g].substr(0, 2));
  281. classOrderPP.push(classOrderP[g]);
  282. gradeOrderPP.push(gradeOrderP[g]);
  283. classOrderQ.push(decimal(classOrder[g] * 100, 1));
  284. gradeOrderQ.push(decimal(gradeOrder[g] * 100, 1));
  285. }
  286. for (var i in ysClassOrderP) {
  287. seNameDicP3.push(seNameDic[i]);
  288. ysClassOrderPP.push(ysClassOrderP[i]);
  289. ysClassOrderQ.push(decimal(ysClassOrder[i] * 100, 1));
  290. }
  291. var sOp1 = {
  292. textStyle: {
  293. fontFamily: 'Noto Serif SC'
  294. },
  295. title: {
  296. text: '分数',
  297. textStyle: {
  298. fontSize: 14,
  299. fontStyle: 'normal',
  300. fontWeight: 'bold',
  301. },
  302. },
  303. tooltip: {
  304. trigger: 'axis'
  305. },
  306. legend: {
  307. data: ['0%', '25%', '50%', '75%', '100%', '满分', '平均分', '我的分数']
  308. },
  309. toolbox: {
  310. show: true,
  311. feature: {
  312. saveAsImage: {
  313. show: true
  314. },
  315. dataView: {
  316. show: true,
  317. readOnly: false
  318. }
  319. },
  320. padding: 25,
  321. orient: 'vertical'
  322. },
  323. calculable: true,
  324. xAxis: [{
  325. type: 'category', data: seNameDicP,
  326. name: '科目',
  327. position: 'left'
  328. }],
  329. yAxis: [{
  330. type: 'value', name: '分数', position: 'left'
  331. }],
  332. series: [{
  333. name: '0%', type: 'line', data: rate0P, color: '#5cb85c'
  334. }, {
  335. name: '25%', type: 'line', data: rate25P, color: '#c7dc68'
  336. }, {
  337. name: '50%', type: 'line', data: rate50P, color: '#c7dc68'
  338. }, {
  339. name: '75%', type: 'line', data: rate75P, color: '#c7dc68'
  340. }, {
  341. name: '100%', type: 'line', data: rate100P, color: '#5cb85c'
  342. }, {
  343. name: '满分', type: 'line', data: rateFullP, color: '#f0ad4e'
  344. }, {
  345. name: '平均分', type: 'line', data: avgPP, color: '#337ab7'
  346. }, {
  347. name: '我的分数', type: 'line', data: scorePP, color: '#e2041b'
  348. }],
  349. };
  350. var sOp2 = {
  351. textStyle: {
  352. fontFamily: 'Noto Serif SC'
  353. },
  354. title: {
  355. text: '得分率',
  356. textStyle: {
  357. fontSize: 14,
  358. fontStyle: 'normal',
  359. fontWeight: 'bold',
  360. },
  361. },
  362. tooltip: {
  363. trigger: 'axis'
  364. },
  365. legend: {
  366. data: ['0%', '25%', '50%', '75%', '100%', '平均得分率', '我的得分率']
  367. },
  368. toolbox: {
  369. show: true,
  370. feature: {
  371. saveAsImage: {
  372. show: true
  373. },
  374. dataView: {
  375. show: true,
  376. readOnly: false
  377. }
  378. },
  379. padding: 25,
  380. orient: 'vertical'
  381. },
  382. calculable: true,
  383. xAxis: [{
  384. type: 'category',
  385. data: seNameDicP,
  386. name: '科目',
  387. position: 'left'
  388. }],
  389. yAxis: [{
  390. type: 'value',
  391. name: '得分率(%)',
  392. position: 'left'
  393. }],
  394. series: [{
  395. name: '0%', type: 'line', data: rate0Q, color: '#5cb85c'
  396. }, {
  397. name: '25%', type: 'line', data: rate25Q, color: '#c7dc68'
  398. }, {
  399. name: '50%', type: 'line', data: rate50Q, color: '#c7dc68'
  400. }, {
  401. name: '75%', type: 'line', data: rate75Q, color: '#c7dc68'
  402. }, {
  403. name: '100%', type: 'line', data: rate100Q, color: '#5cb85c'
  404. }, {
  405. name: '平均得分率', type: 'line', data: avgQ, color: '#337ab7'
  406. }, {
  407. name: '我的得分率', type: 'line', data: scoreQ, color: '#d9534f'
  408. }
  409. ]
  410. };
  411. var oOp1 = {
  412. textStyle: {
  413. fontFamily: 'Noto Serif SC'
  414. }, title: {
  415. text: '行政排名位次',
  416. textStyle: {
  417. fontSize: 14,
  418. fontStyle: 'normal',
  419. fontWeight: 'bold'
  420. },
  421. },
  422. tooltip: {
  423. trigger: 'axis'
  424. },
  425. legend: {
  426. data: ['班级排名', '年级排名']
  427. },
  428. toolbox: {
  429. show: true,
  430. feature: {
  431. saveAsImage: {
  432. show: true
  433. },
  434. dataView: {
  435. show: true,
  436. readOnly: false
  437. }
  438. },
  439. padding: 25,
  440. orient: 'vertical'
  441. },
  442. calculable: true,
  443. xAxis: [{
  444. type: 'category', data: seNameDicP2,
  445. name: '科目',
  446. position: 'left'
  447. }],
  448. yAxis: [{
  449. type: 'value',
  450. name: '排名',
  451. position: 'left'
  452. }],
  453. series: [{
  454. name: '班级排名', type: 'bar', data: classOrderPP, color: '#5bc0de'
  455. }, {
  456. name: '年级排名', type: 'bar', data: gradeOrderPP, color: '#337ab7'
  457. }
  458. ]
  459. };
  460. var oOp2 = {
  461. textStyle: {
  462. fontFamily: 'Noto Serif SC'
  463. }, title: {
  464. text: '行政排名比例',
  465. textStyle: {
  466. fontSize: 14,
  467. fontStyle: 'normal',
  468. fontWeight: 'bold'
  469. },
  470. },
  471. tooltip: {
  472. trigger: 'axis'
  473. },
  474. legend: {
  475. data: ['班级排名(%)', '年级排名(%)']
  476. },
  477. toolbox: {
  478. show: true,
  479. feature: {
  480. saveAsImage: {
  481. show: true
  482. },
  483. dataView: {
  484. show: true,
  485. readOnly: false
  486. }
  487. },
  488. padding: 25,
  489. orient: 'vertical'
  490. },
  491. calculable: true,
  492. xAxis: [{
  493. type: 'category', data: seNameDicP2,
  494. name: '科目',
  495. position: 'left'
  496. }],
  497. yAxis: [{
  498. type: 'value',
  499. name: '排名(%)',
  500. position: 'left'
  501. }],
  502. series: [{
  503. name: '班级排名(%)', type: 'bar', data: classOrderQ, color: '#5bc0de'
  504. }, {
  505. name: '年级排名(%)', type: 'bar', data: gradeOrderQ, color: '#337ab7'
  506. }
  507. ]
  508. };
  509. var oOp3 = {
  510. textStyle: {
  511. fontFamily: 'Noto Serif SC'
  512. }, title: {
  513. text: '分班排名位次',
  514. textStyle: {
  515. fontSize: 14,
  516. fontStyle: 'normal',
  517. fontWeight: 'bold'
  518. },
  519. },
  520. tooltip: {
  521. trigger: 'axis'
  522. },
  523. legend: {
  524. data: ['分班排名']
  525. },
  526. toolbox: {
  527. show: true,
  528. feature: {
  529. saveAsImage: {
  530. show: true
  531. },
  532. dataView: {
  533. show: true,
  534. readOnly: false
  535. }
  536. },
  537. padding: 25,
  538. orient: 'vertical'
  539. },
  540. calculable: true,
  541. xAxis: [{
  542. type: 'category', data: seNameDicP3,
  543. name: '科目',
  544. position: 'left'
  545. }],
  546. yAxis: [{
  547. type: 'value',
  548. name: '排名',
  549. position: 'left'
  550. }],
  551. series: [{
  552. name: '分班排名', type: 'bar', data: ysClassOrderPP, color: '#5cb85c'
  553. }
  554. ]
  555. };
  556. var oOp4 = {
  557. textStyle: {
  558. fontFamily: 'Noto Serif SC'
  559. }, title: {
  560. text: '分班排名比例',
  561. textStyle: {
  562. fontSize: 14,
  563. fontStyle: 'normal',
  564. fontWeight: 'bold'
  565. },
  566. },
  567. tooltip: {
  568. trigger: 'axis'
  569. },
  570. legend: {
  571. data: ['分班排名(%)']
  572. },
  573. toolbox: {
  574. show: true,
  575. feature: {
  576. saveAsImage: {
  577. show: true
  578. },
  579. dataView: {
  580. show: true,
  581. readOnly: false
  582. }
  583. },
  584. padding: 25,
  585. orient: 'vertical'
  586. },
  587. calculable: true,
  588. xAxis: [{
  589. type: 'category', data: seNameDicP3,
  590. name: '科目',
  591. position: 'left'
  592. }],
  593. yAxis: [{
  594. type: 'value',
  595. name: '排名(%)',
  596. position: 'left'
  597. }],
  598. series: [{
  599. name: '分班排名(%)', type: 'bar', data: ysClassOrderQ, color: '#5cb85c'
  600. }
  601. ]
  602. };
  603. // 为echarts对象加载数据
  604. sChart1.setOption(sOp1);
  605. sChart2.setOption(sOp2);
  606. oChart1.setOption(oOp1);
  607. oChart2.setOption(oOp2);
  608. oChart3.setOption(oOp3);
  609. oChart4.setOption(oOp4);
  610. }
  611. reader.readAsText(file);
  612. }