function getOneClass() {
var examdate = document.getElementById("exam").value;
var examname=$('#exam').find("option:selected").attr('name');
var kskm=$("#id_select").val();
var classid=document.getElementById("banji").value;
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch(e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
alert("您的浏览器不支持该操作,推荐您使用最新的谷歌浏览器!");
return;
}
}
var url = "http://<%=request.getServerName()%>:<%=request.getLocalPort()%><%=this.getServletContext().getContextPath()%>/SelectServlet?type=selectChengJiBiLi&ksrq="+examdate+"&ksmc="+examname+"&kmmc="+kskm+"&classid="+classid;
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
var str = xmlHttp.responseText;
var obj = eval('(' + str + ')');
var fenshuduan=obj.fenshuduan;
var kcmcs=obj.kcmc;
var Series=obj.series;
var myChart = echarts.init(document.getElementById('oneClass'));
var option = {
title: {
text: '考试成绩分析',
textStyle: {
color: '#fff'
}
},
tooltip: {
trigger: 'axis'
},
toolbox: {
show: true,
feature: {
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['line', 'bar']
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
legend: {
left: 'left',
top: 30,
data: kcmcs,
textStyle: {
color: '#fff'
}
},
textStyle: {
color: '#fff'
},
color: ['#DDB404', '#F1495F', '#00A0E9', '#32B16A', '#91c7ae', '#749f83'],
xAxis: {
type: 'category',
data: fenshuduan,
textStyle: {
color: '#fff'
}
},
yAxis: {
type: 'value',
textStyle: {
color: '#fff'
}
},
series: Series
};
myChart.clear();//新建之前先清空内容
myChart.setOption(option);
var examdate = document.getElementById("exam").value;
var examname=$('#exam').find("option:selected").attr('name');
var kskm=$("#id_select").val();
var classid=document.getElementById("banji").value;
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch(e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
alert("您的浏览器不支持该操作,推荐您使用最新的谷歌浏览器!");
return;
}
}
var url = "http://<%=request.getServerName()%>:<%=request.getLocalPort()%><%=this.getServletContext().getContextPath()%>/SelectServlet?type=selectChengJiBiLi&ksrq="+examdate+"&ksmc="+examname+"&kmmc="+kskm+"&classid="+classid;
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
var str = xmlHttp.responseText;
var obj = eval('(' + str + ')');
var fenshuduan=obj.fenshuduan;
var kcmcs=obj.kcmc;
var Series=obj.series;
var myChart = echarts.init(document.getElementById('oneClass'));
var option = {
title: {
text: '考试成绩分析',
textStyle: {
color: '#fff'
}
},
tooltip: {
trigger: 'axis'
},
toolbox: {
show: true,
feature: {
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['line', 'bar']
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
legend: {
left: 'left',
top: 30,
data: kcmcs,
textStyle: {
color: '#fff'
}
},
textStyle: {
color: '#fff'
},
color: ['#DDB404', '#F1495F', '#00A0E9', '#32B16A', '#91c7ae', '#749f83'],
xAxis: {
type: 'category',
data: fenshuduan,
textStyle: {
color: '#fff'
}
},
yAxis: {
type: 'value',
textStyle: {
color: '#fff'
}
},
series: Series
};
myChart.clear();//新建之前先清空内容
myChart.setOption(option);
}
效果图: