$(function () {
function hexToRgba(hex, opacity) {
var rgbaColor = "";
var reg = /^#[\da-f]{6}$/i;
if (reg.test(hex)) {
rgbaColor = 'rgba(' + parseInt("0x" + hex.slice(1, 3)) + ',' + parseInt("0x" + hex.slice(3, 5))
+ ',' + parseInt("0x" + hex.slice(5, 7)) + ',' + opacity + ')'
}
return rgbaColor;
}
function initlargeAnalysisEcharts(s_index,list) {
var schoolscore = [],
classscore = [],
legendlist = [currentclass, "全年级"];
$.each(list, function (idx, item) {
if (item.subjectname != "全科") {
classscore.push(item.classavgscore);
schoolscore.push(item.gradeavgscore);
}
});
// 求出数组最大值
let arr = [...schoolscore, ...classscore];
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.qtypename,
max: maxnum
};
arrList.push(j);
}
});
var option = {
animation: false,
color: ["#5C99FF", "#5EC5C8"],
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: classscore,
label: {
show: true,
formatter: function (params) {
return params.value;
}
},
name: currentclass
},
{
value: schoolscore,
label: {
show: true,
formatter: function (params) {
return params.value;
}
},
name: "全年级"
}
]
}
};
var myEcharts = echarts.init(
document.querySelector(".section_3_"+s_index +" #largeAnalysisEcharts")
);
myEcharts.clear();
myEcharts.setOption(option);
showlargeAnalysistable(list,legendlist,s_index);
}
function showlargeAnalysistable (list,legendlist,s_index) {
var table = "",goodTableHeadTr1Html = '
题型 | 对应题号 | 分值 | 占比 | 年级 | '+currentclass+' | ',
goodTableHeadTr2Html = "", trHtml = "";
$.each(list, function (idx, item) {
trHtml += "";
trHtml+= '' +
item.qtypename +
' | ' +
item.qns +
' | ' +
item.score +
' | ' +
item.srate +
'% | ' +
item.gradeavgscore +
' | ' +
item.gradesrate +
'% | ' +
item.classavgscore +
' | ' +
item.classsrate +
"%" +
' | ';
})
$.each(legendlist, function (idx, item) {
goodTableHeadTr2Html+="平均分 | 得分率 | ";
})
table =' ' +
goodTableHeadTr1Html +
'
' +
goodTableHeadTr2Html +
'
' +
trHtml +
"
"
$(".section_3_"+s_index +" .largeAnalysistable").html(table)
}
function initSmallAnalysisEcharts (s_index,list) {
let legendlist = [currentclass, "全年级"],
xAxis_data = [],
schoolscore = [],
classscore = [],
curseries = [];
$.each(list, function (idx, item) {
xAxis_data.push("第" + item.qn + "题");
classscore.push(item.classavgscore);
schoolscore.push(item.gradeavgscore);
})
let color = ["#5699FF", "#5EC5C8"];
curseries = [
{
name: currentclass,
type: "line",
symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
smooth: false, //折线是否弯曲
// symbol: "emptyCircle",
symbolSize: 6,
itemStyle: {
normal: {
color: "#4190FF" // 拐点外圈颜色
}
},
label: {
normal: {
show: true,
align: "center",
verticalAlign: "bottom",
position: "top",
distance: 0,
formatter: `{c}`
}
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: hexToRgba(color[0], 0.3)
},
{
offset: 1,
color: hexToRgba(color[0], 0)
}
],
false
),
shadowColor: hexToRgba(color[0], 0),
shadowBlur: 10
}
},
data: classscore
},
{
name: "全年级",
type: "line",
// smooth: true, //是否平滑曲线显示
symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
smooth: false, //折线是否弯曲
// symbol: "emptyCircle",
symbolSize: 6,
// zlevel: 3,
itemStyle: {
normal: {
color: "#5FCE9E" // 拐点外圈颜色
}
},
label: {
normal: {
show: true,
align: "center",
verticalAlign: "bottom",
position: "top",
distance: 0,
formatter: `{c}`
}
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: hexToRgba(color[1], 0.3)
},
{
offset: 1,
color: hexToRgba(color[1], 0)
}
],
false
),
shadowColor: hexToRgba(color[1], 0),
shadowBlur: 10
}
},
data: schoolscore
}
];
let option = {
animation: false,
color: ["#5699FF", "#5EC5C8"],
title: {
text: "分",
x: "left",
y: "top",
textStyle: {
color: "#5F6E82",
fontSize: 12,
fontWeight: 500
}
},
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
},
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(".section_3_"+s_index +" #SmallAnalysisEcharts")
);
myEcharts.clear();
myEcharts.setOption(option);
showSmallSmallAnalysistable(list,legendlist,s_index);
}
function showSmallSmallAnalysistable (list,legendlist,s_index) {
var table = "",goodTableHeadTr1Html = '题号 | 题型 | 分值 | 难度 | 年级 | '+currentclass+' | ',
goodTableHeadTr2Html = "", trHtml = "";
var complexityarr = ["一", "二", "三", "四", "五"];
$.each(list, function (idx, item) {
var complexity = item.complexity ? complexityarr[item.complexity - 1] + "星" : " ";
trHtml += "
";
trHtml+= '' +
item.qn +
' | ' +
item.qtypename +
' | ' +
item.score +
' | ' +
complexity +
' | ' +
item.gradeavgscore +
' | ' +
item.gradesrate +
'% | ' +
item.classavgscore +
' | ' +
item.classsrate +
"%" +
' | ';
})
$.each(legendlist, function (idx, item) {
goodTableHeadTr2Html+="平均分 | 得分率 | ";
})
table =' ' +
goodTableHeadTr1Html +
'
' +
goodTableHeadTr2Html +
'
' +
trHtml +
"
"
$(".section_3_" + s_index + " .SmallAnalysistable").html(table);
}
function initpointsAnalysisEcharts (s_index, list) {
if (list.length == 0) return;
console.log(list);
var schoolscore = [],
classscore = [],
legendlist = [currentclass+"得分率", "年级得分率"];
$.each(list, function (idx, item) {
if (item.subjectname != "全科") {
classscore.push(item.classsrate);
schoolscore.push(item.gradesrate);
}
});
// 求出数组最大值
let arr = [...schoolscore, ...classscore];
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.pointname,
max: maxnum
};
arrList.push(j);
}
});
var option = {
animation: false,
color: ["#5C99FF", "#FF5F56"],
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: classscore,
label: {
show: true,
formatter: function (params) {
return params.value;
}
},
name: currentclass+"得分率"
},
{
value: schoolscore,
label: {
show: true,
formatter: function (params) {
return params.value;
}
},
name: "年级得分率"
}
]
}
};
var myEcharts = echarts.init(
document.querySelector(".section_3_"+s_index +" #pointsAnalysisEcharts")
);
myEcharts.clear();
myEcharts.setOption(option);
showpointsAnalysistable(list,legendlist,s_index);
}
function showpointsAnalysistable (list, legendlist, s_index) {
var table = "",goodTableHeadTr1Html = '知识点 | 对应题号 | 分值 | 占比 | 年级 | '+currentclass+' | ',
goodTableHeadTr2Html = "", trHtml = "";
$.each(list, function (idx, item) {
trHtml += "
";
trHtml+= '' +
item.pointname +
' | ' +
item.qns +
' | ' +
item.score +
' | ' +
item.srate +
'% | ' +
item.gradeavgscore +
' | ' +
item.gradesrate +
'% | ' +
item.classavgscore +
' | ' +
item.classsrate +
"%" +
' | ';
})
$.each(legendlist, function (idx, item) {
goodTableHeadTr2Html+="平均分 | 得分率 | ";
})
table =' ' +
goodTableHeadTr1Html +
'
' +
goodTableHeadTr2Html +
'
' +
trHtml +
"
"
$(".section_3_" + s_index + " .pointsAnalysistable").html(table);
console.log($(".section_3_" + s_index + " .pointsAnalysistable").height());
var
}
var parameter = $(".section_3_html_root").data("page-params");
parameter = JSON.parse(parameter);
var html = "";
$.each(parameter, function (s_index, item) {
html+=''+
(s_index == 0?'
第三章 试卷分析
从学科试卷分析,帮我们从宏观的角度了解班级的水平和差异。系统从多个维度的数据进行学科对比分析,包括大题年级和班级的(平均分、得分率)、小题年级和班级的(平均分、得分率)。
':"")+
'
'+item.subjectname+'试卷分析
1. 大题分析
1.1 大题分析
1.2 大题整体分析
2. 小题分析
2.1 小题分析
2.2 小题整体分析
'+(item.points.length>0?'3. 知识点掌握整体概况
3.1 知识点得分率分析
3.2 知识点整体分析
':"")
})
$(".ChapterThree").html(html);
console.log(parameter);
$.each(parameter, function (s_index, item) {
initlargeAnalysisEcharts(s_index, item.types);
initSmallAnalysisEcharts(s_index, item.questions);
initpointsAnalysisEcharts(s_index, item.points);
})
document.documentElement.scrollTop = 4000;
});