123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263 |
- $(function () {
- function initAverageScoreEcharts(list, xAxis_data) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var score = [],
- maxscore = [],
- minscore = [],
- avgscore = [];
- var curlegend = ["满分", "最高分", "最低分", "平均分"];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- score.push(item.allscore);
- maxscore.push(item.classmaxscore);
- minscore.push(item.classminscore);
- avgscore.push(item.classavgscore);
- }
- var curseries = [
- {
- name: "满分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: score,
- itemStyle: itemStyle
- },
- {
- name: "最高分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: maxscore,
- itemStyle: itemStyle
- },
- {
- name: "最低分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: minscore,
- itemStyle: itemStyle
- },
- {
- name: "平均分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: avgscore,
- itemStyle: itemStyle
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init($(".section1 #averagescoreEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- }
-
- function initExcellenceRateEcharts(list, xAxis_data) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var yxrate = [],
- lhrate = [],
- jgrate = [],
- dfrate = [];
- var curlegend = ["优秀率", "良好率", "及格率", "低分率"];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- yxrate.push(item.yxrate);
- lhrate.push(item.lhrate);
- jgrate.push(item.jgrate);
- dfrate.push(item.dfrate);
- }
- var curseries = [
- {
- name: "优秀率",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: yxrate,
- itemStyle: itemStyle
- },
- {
- name: "良好率",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: lhrate,
- itemStyle: itemStyle
- },
- {
- name: "及格率",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: jgrate,
- itemStyle: itemStyle
- },
- {
- name: "低分率",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: dfrate,
- itemStyle: itemStyle
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init($(".section1 #excellencerateEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- }
-
- function initExamnumEcharts(list, xAxis_data) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var stunum = [],
- missnum = [];
- var curlegend = ["实考人数", "缺考人数"];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- stunum.push(item.stunum);
- missnum.push(item.missnum);
- }
- var curseries = [
- {
- name: "实考人数",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: stunum,
- itemStyle: itemStyle
- },
- {
- name: "缺考人数",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: missnum,
- itemStyle: itemStyle
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init(
- document.querySelector(".section1 #examnumEcharts")
- );
- myEcharts.clear();
- myEcharts.setOption(option);
- }
-
- function initbzcEcharts(list, xAxis_data) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var bzc = [];
- var curlegend = ["标准差"];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- bzc.push(item.bzc);
- }
- var curseries = [
- {
- name: "标准差",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: bzc,
- itemStyle: itemStyle
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init($(".section1 #bzcEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- }
-
- function initexamaverageEcharts(list, xAxis_data) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var stunum = [],
- missnum = [];
- var curlegend = ["平均分", "校平均分"];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- stunum.push(item.classavgscore);
- missnum.push(item.schoolavgscore);
- }
- var curseries = [
- {
- name: "平均分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: stunum,
- itemStyle: itemStyle
- },
- {
- name: "校平均分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: missnum,
- itemStyle: itemStyle
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init($(".section1 #examaverageEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- }
-
- function initscoreGradeEcharts(list) {
- var xAxis_data = [],
- series_data = [],
- legend_data = [],
- levelRateObj = {},
- levelNumObj = {},
- levelrangeObj = [];
- $.each(list, function (key, item) {
- if (item.subjectname == "总分") {
- item.subjectname = "全科";
- }
- if ($.inArray(item.subjectname, xAxis_data) == -1) {
- xAxis_data.push(item.subjectname);
- }
- if ($.inArray(item.rankname + "类", legend_data) == -1) {
- legend_data.push(item.rankname + "类");
- }
- if ($.inArray(item.rankrange, levelrangeObj) == -1) {
- levelrangeObj.push(item.rankrange);
- }
- if (!levelRateObj[item.rankname + "类"]) {
- levelRateObj[item.rankname + "类"] = [];
- }
- levelRateObj[item.rankname + "类"].push(item.sturate);
- if (!levelNumObj[item.rankname + "类"]) {
- levelNumObj[item.rankname + "类"] = [];
- }
- levelNumObj[item.rankname + "类"].push(item.stunum);
- });
- $.each(legend_data, function (key, item) {
- series_data.push({
- name: item,
- type: "bar",
- stack: "总量",
- barWidth: 32,
- // 柱状图最小高度
- barMinHeight: 16,
- showBackground: true, // 柱状图显示背景
- backgroundStyle: {
- color: "#F3F4F5"
- },
- itemStyle: {
- normal: {
- barBorderRadius: [4, 4, 4, 4]
- }
- },
- label: {
- normal: {
- show: true,
- align: "center",
- verticalAlign: "middle",
- position: "inside",
- distance: 0,
- color: "#fff",
- formatter: function (params) {
- return levelNumObj[params.seriesName][params.dataIndex] || 0;
- }
- }
- },
- data: levelNumObj[item]
- });
- });
- showgraphicaldata(xAxis_data, legend_data, levelrangeObj, list);
- var option = {
- color: ["#5C99FF", "#ff5f56", "#5EC5C8", "#f1982b", "#6e5eff"],
- animation: false,
- title: {
- text: "%",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: legend_data
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82", //更改坐标轴文字颜色
- interval: 0
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: series_data
- };
- var myEcharts = echarts.init($(".section1 #scoreGradeEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- }
- //图表数据
- function showgraphicaldata(xAxis_data, legend_data, levelrangeObj, list) {
- //图表数据
- var arr = JSON.parse(JSON.stringify(list));
- var tableobj = {};
- var tablehtml = "";
- $.each(xAxis_data, function (idx, item) {
- var classs = $.grep(arr, function (val) {
- return val.subjectname == item;
- });
- tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] =
- '<th rowspan="2">科目</th>';
- tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] = "";
- tableobj[classs[0].subjectname + "goodTableTbodyHtml"] = "";
- $.each(classs, function (idx, item) {
- tableobj[item.subjectname + "goodTableHeadTr1Html"] +=
- '<th colspan="2">' + item.rankname + "类" + item.rankrange + "</th>";
- tableobj[item.subjectname + "goodTableHeadTr2Html"] +=
- "<th>人数</th><th>比例</th>";
- if (idx == 0) {
- tableobj[item.subjectname + "goodTableTbodyHtml"] +=
- '<td><div class="my_cell">' + item.subjectname + "</div></td>";
- }
- tableobj[item.subjectname + "goodTableTbodyHtml"] +=
- '<td><div class="my_cell">' +
- item.stunum +
- '</div></td><td><div class="my_cell">' +
- item.sturate +
- "%</div></td>";
- });
- tablehtml +=
- ' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
- tableobj[classs[0].subjectname + "goodTableHeadTr1Html"] +
- '</tr><tr class="goodTableHeadTr2">' +
- tableobj[classs[0].subjectname + "goodTableHeadTr2Html"] +
- '</tr></thead><tbody class="goodTableTbody">' +
- tableobj[classs[0].subjectname + "goodTableTbodyHtml"] +
- "</tbody></table>";
- });
- $(".section1 .gradescale").html(tablehtml);
- }
-
- function initclassscorePartEcharts(list) {
- var xAxis_data = [];
- var dataArr = [];
- var arr = $.grep(list, function (val) {
- return val.subjectid == "zf";
- });
- $.each(arr, function (index, item) {
- if (index == 0) {
- var rank = item.rankname.slice(3, 5) - item.rankname.slice(1, 2);
- $(".section1 .classPartEcharts").text(rank);
- }
- xAxis_data.push(item.rankname);
- dataArr.push(item.stunum);
- });
- var series_data = [
- {
- name: "全科",
- type: "line",
- symbol: "circle",
- stack: "全科",
- label: {
- normal: {
- show: true,
- align: "center",
- verticalAlign: "bottom",
- position: "top",
- distance: 0,
- formatter: `{c}`
- }
- },
- data: dataArr
- }
- ];
- var option = {
- animation: false,
- title: {
- text: "人",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- color: ["#5C99FF", "#ff5f56", "#5EC5C8", "#f1982b", "#6e5eff"],
- legend: {
- icon: "roundRect",
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: ["全科"]
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: {
- type: "category",
- axisLabel: {
- textStyle: {
- color: "#5F6E82"
- },
- interval: 2,
- rotate: 0
- },
- axisTick: {
- show: false
- },
- data: xAxis_data
- },
- yAxis: {
- axisLabel: {
- textStyle: {
- color: "#9B9B9BFF"
- },
- interval: 0
- },
- minInterval: 1,
- axisLine: {
- show: false
- },
- axisTick: {
- show: false
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
- color: "#DADADA"
- },
- show: true //隐藏或显示
- },
- type: "value"
- },
- series: series_data
- };
- var myEcharts = echarts.init($(".section1 #classscorePartEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- showscoredistributiondata(list, xAxis_data, dataArr);
- }
-
- function showscoredistributiondata(list, xAxis_data) {
- var tableobj = {};
- var num = -1,
- rownum = 6; //一行六条数据
- $.each(xAxis_data, function (idx, item) {
- var obj = $.grep(list, function (val) {
- return val.rankname == item && val.subjectid == "zf";
- })[0];
- if ((idx + rownum) % rownum == 0) {
- num++;
- tableobj[num + "goodTableHeadTr1Html"] = '<th rowspan="2">科目</th>';
- tableobj[num + "goodTableHeadTr2Html"] = "";
- tableobj[num + "trHtml"] = '<td><div class="my_cell">全科</div></td>';
- }
- tableobj[num + "goodTableHeadTr1Html"] +=
- '<th colspan="2">' + item + "</th>";
- tableobj[num + "goodTableHeadTr2Html"] += "<th>人数</th><th>比例</th>";
- tableobj[num + "trHtml"] +=
- '<td><div class="my_cell">' +
- obj.stunum +
- '</div></td><td><div class="my_cell">' +
- obj.sturate +
- "%</div></td>";
- });
- //计算表格高度 页面高1047 剩余高度582 表头62.5 内容27.42
- var tableheight = (27.5 + 62.5 + 15) * (num + 1);
- var page = {
- 1: "",
- 2: "",
- 3: ""
- }; //页数
- var table = "";
- var itemheight = 27.5 + 62.5 + 15; //单表高度
- var maxheight = 0;
- for (var i = 0; i < num + 1; i++) {
- maxheight = itemheight * (i + 1);
- var content =
- ' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
- tableobj[i + "goodTableHeadTr1Html"] +
- '</tr><tr class="goodTableHeadTr2">' +
- tableobj[i + "goodTableHeadTr2Html"] +
- '</tr></thead><tbody class="goodTableTbody">' +
- tableobj[i + "trHtml"] +
- "</tbody></table>";
- //计算剩余高度是否能显示最后一个表格
- if (maxheight > 582 && 582 - maxheight < itemheight) {
- page[1] += content;
- } else if (maxheight > 1629 && 1629 - maxheight < itemheight) {
- page[2] += content;
- } else {
- table += content;
- }
- }
- $(".table_num0 .scoredistribution").html(table);
- if (tableheight > 582) {
- //添加第一页
- $(".table_num0").after(
- '<div class="page_root section_2_part table_num1"></div>'
- );
- $(".table_num1").html(page[1]);
- } else if (tableheight > 1629) {
- //添加第二页
- $(".table_num1").after(
- '<div class="page_root section_2_part table_num2"></div>'
- );
- $(".table_num2").html(page[2]);
- }
- }
-
- function initgoodbadSubjectEcharts(list) {
- var schoolrate = [],
- classrate = [],
- legendlist = ["全年级", list[0].classname];
- $.each(list, function (idx, item) {
- if (item.subjectname != "全科") {
- classrate.push(
- parseInt(
- ((item.classavgscore - item.schoolavgscore) / item.bzc) * 10000
- ) / 100 || 0
- );
- schoolrate.push(
- parseInt((item.classavgscore / item.schoolavgscore) * 10000) / 100 ||
- 0
- );
- }
- });
- // 求出数组最大值
- let arr = [...schoolrate, ...classrate],
- yssubject = "",
- lssubject = "";
- let arr1 = Math.max.apply(null, arr);
- let maxnum = parseInt((arr1 + 10) / 10) * 10;
- let arrList = [];
- $.each(list, function (idx, item) {
- if (item.subjectname != "全科") {
- let j = {
- name: item.subjectname,
- max: maxnum
- };
- arrList.push(j);
- if (item.bzc > item.qkbzc) {
- yssubject += item.subjectname + "、";
- } else {
- lssubject += item.subjectname + "、";
- }
- }
- });
- yssubject = yssubject.substr(0, yssubject.length - 1);
- lssubject = lssubject.substr(0, lssubject.length - 1);
- $(".section1 .yssubject").text(yssubject); // 优势
- $(".section1 .lssubject").text(lssubject); // 劣势
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- legend: {
- icon: "rectRound",
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- data: legendlist,
- x: "center",
- y: "bottom"
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- radar: {
- radius: "60%",
- center: ["50%", "55%"],
- indicator: arrList
- },
- series: {
- type: "radar",
- tooltip: {
- trigger: "item"
- },
- // areaStyle: {}, //内部阴影
- data: [
- {
- value: schoolrate,
- label: {
- show: true,
- formatter: function (params) {
- return params.value;
- }
- },
- name: "全年级"
- },
- {
- value: classrate,
- label: {
- show: true,
- formatter: function (params) {
- return params.value;
- }
- },
- name: list[0].classname
- }
- ]
- }
- };
- var myEcharts = echarts.init($(".section1 #goodbadSubjectEcharts")[0]);
- myEcharts.clear();
- myEcharts.setOption(option);
- showgoodbadtable(list, legendlist, schoolrate, classrate);
- }
-
- function showgoodbadtable(list, legendlist, schoolrate, classrate) {
- var table = "",
- goodTableHeadTr1Html = "<th >班级</th>",
- goodTableHeadTr2Html = "",
- trHtml = "";
- $.each(list, function (idx, item) {
- if (item.subjectname != "全科") {
- goodTableHeadTr1Html += "<th>" + item.subjectname + "</th>";
- }
- });
- $.each(legendlist, function (idx, item) {
- trHtml += "<tr><th>" + item + "</th>";
- if (idx == 0) {
- $.each(schoolrate, function (idx, item) {
- trHtml += "<th>" + item + "%</th>";
- });
- } else {
- $.each(classrate, function (idx, item) {
- trHtml += "<th>" + item + "%</th>";
- });
- }
- });
- table =
- '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
- goodTableHeadTr1Html +
- '</tr></thead><tbody class="goodTableTbody">' +
- trHtml +
- "</tbody></table>";
- $(".section1 .goodbadtable").html(table);
- }
- var parameter = JSON.parse($(".section_1_html_root").data("page-params"));
- var xAxis_data = [],
- html = "";
- var mfclass = {
- num: 0,
- classname: ""
- },
- yxclass = {
- num: 0,
- classname: ""
- },
- lhclass = {
- num: 0,
- classname: ""
- },
- jgclass = {
- num: 0,
- classname: ""
- },
- dfclass = {
- num: 0,
- classname: ""
- },
- skclass = {
- num: 0,
- classname: ""
- },
- qkclass = {
- num: 0,
- classname: ""
- },
- goodclass = {
- num: 0,
- classname: ""
- },
- badclass = {
- num: 0,
- classname: ""
- };
- for (var i = 0; i < parameter.xkcj.length; i++) {
- var item = parameter.xkcj[i];
- if (item.subjectname == "总分") {
- item.subjectname = "全科";
- } else {
- if (mfclass.num < item.allscore) {
- mfclass = {
- num: item.allscore,
- classname: item.subjectname
- };
- }
- if (yxclass.num < item.yxrate) {
- yxclass = {
- num: item.yxrate,
- classname: item.subjectname
- };
- }
- if (lhclass.num < item.lhrate) {
- lhclass = {
- num: item.lhrate,
- classname: item.subjectname
- };
- }
- if (jgclass.num < item.jgrate) {
- jgclass = {
- num: item.jgrate,
- classname: item.subjectname
- };
- }
- if (dfclass.num < item.dfrate) {
- dfclass = {
- num: item.dfrate,
- classname: item.subjectname
- };
- }
- if (skclass.num < item.stunum) {
- skclass = {
- num: item.stunum,
- classname: item.subjectname
- };
- } else if (skclass.num == item.stunum) {
- skclass.classname += "、" + item.subjectname;
- }
- if (qkclass.num < item.missnum) {
- qkclass = {
- num: item.missnum,
- classname: item.subjectname
- };
- } else if (qkclass.num == item.stunum) {
- qkclass.classname += "、" + item.subjectname;
- }
- if (item.bzc > item.qkbzc) {
- goodclass.classname += item.subjectname + "、";
- } else {
- badclass.classname += item.subjectname + "、";
- }
- }
- html +=
- '<tr><td><div class="my_cell">' +
- (item.subjectname || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.stunum || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.missnum || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.score || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.maxscore || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.minscore || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.avgscore || 0) +
- '</div></td><td><div class="my_cell">' +
- (item.yxrate || 0) +
- "%" +
- '</div></td><td><div class="my_cell">' +
- (item.lhrate || 0) +
- "%" +
- '</div></td><td><div class="my_cell">' +
- (item.jgrate || 0) +
- "%" +
- '</div></td><td><div class="my_cell">' +
- (item.dfrate || 0) +
- "%" +
- '</div></td><td><div class="my_cell">' +
- (item.bzc || 0) +
- "%</div></td></tr>";
- xAxis_data.push(item.subjectname);
- }
- goodclass.classname = goodclass.classname.substr(
- 0,
- goodclass.classname.length - 1
- );
- badclass.classname = badclass.classname.substr(
- 0,
- badclass.classname.length - 1
- );
- $(".section1 .mfclass").text(mfclass.classname); //满分
- $(".section1 .yxclass").text(yxclass.classname); //优秀
- $(".section1 .lhclass").text(lhclass.classname); //良好
- $(".section1 .jgclass").text(jgclass.classname); //及格
- $(".section1 .dfclass").text(dfclass.classname); //低分
- $(".section1 .skclass").text(skclass.classname); //实考
- $(".section1 .qkclass").text(qkclass.classname); // 缺考
- $(".section1 .goodclass").text(goodclass.classname); //较好
- $(".section1 .badclass").text(badclass.classname); // 较差
- $(".section1 .tbody").html(html); //学科成绩整体分析
- initAverageScoreEcharts(parameter.xkcj, xAxis_data);
- initExcellenceRateEcharts(parameter.xkcj, xAxis_data);
- initExamnumEcharts(parameter.xkcj, xAxis_data);
- initbzcEcharts(parameter.xkcj, xAxis_data);
- initexamaverageEcharts(parameter.xkcj, xAxis_data);
- initscoreGradeEcharts(parameter.fsdjtj, xAxis_data);
- initclassscorePartEcharts(parameter.fsdtj);
- initgoodbadSubjectEcharts(parameter.xkcj);
- // document.documentElement.scrollTop = 6200;
- });
|