$(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( document.querySelector(".section1 #averagescoreEcharts") ); 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( document.querySelector(".section1 #excellencerateEcharts") ); 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( document.querySelector(".section1 #bzcEcharts") ); 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( document.querySelector(".section1 #examaverageEcharts") ); 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( document.querySelector(".section1 #scoreGradeEcharts") ); 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"] = '