hightchat图表展示

来源:互联网 发布:九泰基金 知乎 编辑:程序博客网 时间:2024/05/18 00:44
//查看单个学生成绩状况: 饼状图显示
function single_stu_score_pie() {

$.ajax({
url : encodeURI(urlRootContext
+ '/Stu_score_statistics/single_stu_score_pie.do?'),
data : $("#Form").serialize(),// 表单数据
type : "post",
dataType : "json",
success : function(data) {
var demoSet = [];

for (var i = 0; i < data.list_subject_name.length; i++) {
demoSet.push([
data.list_exam_type[i]+":"+data.list_subject_name[i]+":"+data.list_exam_score[i]+"分",
JSON.parse(data.list_exam_score[i]) ]);


}
var demoSet2 = [];
demoSet2.push([ "个人所占比例", data.onetoclass[0] ], [
"班级所占比例", data.onetoclass[1] ]);
var demoSet3 = [];
demoSet3.push([ "个人所占比例", data.onetodept[0] ], [
"系别所占比例", data.onetodept[0] ]);
// 区域用户饼状图
$('#container')
.highcharts(
{
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
title : {
text : ''
},
tooltip : {
pointFormat : '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions : {
pie : {
allowPointSelect : true,
cursor : 'pointer',
dataLabels : {
enabled : true,
color : '#000000',
connectorColor : '#000000',
format : '<b>{point.name}</b>: {point.percentage:.1f} %'


},
events : {
click : function(e) {
var subject_name = e.point.name;
subject_name = subject_name.replace(
/[ ]/g, "");
var n = subject_name.indexOf(':') + 1;
subject_name = subject_name.substr(n,
subject_name.indexOf(':') - 1);
location.href = encodeURI(urlRootContext
+ "/Stu_score_statistics/add.do?opr=single_stu_score_line&statistics_id="
+ data.stu_score_statistics.statistics_id
+ "&subject_name="
+ subject_name);
}
}


}
},
series : [ {
type : 'pie',
name : '百分比',
data : demoSet


} ]
});





// 区域用户饼状图
$('#container2').highcharts({
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
title : {
text : ''
},
tooltip : {
pointFormat : '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions : {
pie : {
allowPointSelect : true,
cursor : 'pointer',
dataLabels : {
enabled : true,
color : '#000000',
connectorColor : '#000000',
format : '<b>{point.name}</b>: {point.percentage:.1f} %'


}


}
},
series : [ {
type : 'pie',
name : '百分比',
data : demoSet2


} ]
});
// 区域用户饼状图
$('#container3').highcharts({
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
title : {
text : ''
},
tooltip : {
pointFormat : '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions : {
pie : {
allowPointSelect : true,
cursor : 'pointer',
dataLabels : {
enabled : true,
color : '#000000',
connectorColor : '#000000',
format : '<b>{point.name}</b>: {point.percentage:.1f} %'


}


}
},
series : [ {
type : 'pie',
name : '百分比',
data : demoSet3


} ]
});


}
});


}




//查看单个学生的某一科目增长情况: 折线图显示
function single_stu_score_line() {
$.ajax({
url : encodeURI(urlRootContext
+ '/Stu_score_statistics/single_stu_score_line.do?'),
data : $("#Form").serialize(),// 表单数据
type : "post",
dataType : "json",
success : function(data) {
var demoSet = [];

for (var i = 0; i < data.list_exam_type.length; i++) {
demoSet.push([
JSON.parse(data.list_exam_score[i]) ]);
}
//存放考试类型数组
$('#container').highcharts({
chart : {
zoomType : 'xy'
},
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {


type : 'spline'
},
legend : {
enabled : true
},
title : {
text : ''
},
subtitle : {
text : ''
},
xAxis : [ {
categories : data.list_exam_type,
text : '考试类型'
} ],
yAxis : [ {
gridLineWidth : 0,
labels : {
formatter : function() {
return this.value + '';
},
style : {
color : '#FF6633'
}
},


min : 0,
allowDecimals : false,
//是否允许刻度有小数
title : {
text :'成绩',
style : {
color : '#FF6633'
}
}
}, {
labels : {
formatter : function() {
return this.value + '';
},
style : {
color : '#33CC66'
}
},


opposite : true
} ],
tooltip : {
enabled : true
},
plotOptions : {
column : {
pointPadding : 0.2,
borderWidth : 0
},
series : {
point : {
events : {
mouseOver : function() {


}
}
}
},
events : {
mouseOut : function() {
$('#reporting').empty();
}
}
},
series : [ {
name : '成绩',
tooltip : {
valueSuffix : ''
},
type : 'areaspline',
data :demoSet,
color : '#FF6633'
} ]
});
}
});
}

//返回饼状图
function go_pie() {
location.href = encodeURI(urlRootContext
+ '/Stu_score_statistics/add.do?opr=single_stu_score_pie&statistics_id='
+ $("#statistics_id").val());
}
//按班级统计 :柱状图
function class_stu_score_colh() {
$.ajax({
url : encodeURI(urlRootContext
+ '/Stu_score_statistics/class_stu_score_colh.do?'),
data : $("#Form").serialize(),// 表单数据
type : "post",
dataType : "json",
success : function(data) {
var demoSet = [];

for (var i = 0; i < data.list_stu_class.length; i++) {
demoSet.push([
JSON.parse(data.list_class_avg_score[i]) ]);
}

$('#container')
.highcharts(
{
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {
type : 'column'
},
title : {
text : ''
},
subtitle : {
text : ''
},
xAxis : {
categories : data.list_stu_class
},
yAxis : {
min : 0,
title : {
text : '平均分'
},
allowDecimals : false
//是否允许刻度有小数
},
legend : {
enabled : false
},
tooltip : {
headerFormat : '<span style="font-size:10px">{point.key}</span><table>',
pointFormat : '<tr><td style="color:{series.color};padding:0">{series.name}: </td>'
+ '<td style="padding:0"><b>{point.y} 分</b></td></tr>',
footerFormat : '</table>',
shared : true,
useHTML : true
},
plotOptions : {
column : {
dataLabels : {
enabled : true,


},
}
},


series : [ {
name : '平均分',
data : demoSet


} ]
});
}
});



}


//按系统计 :柱状图
function dept_stu_score_colh() {
$.ajax({
url : encodeURI(urlRootContext
+ '/Stu_score_statistics/dept_stu_score_colh.do?'),
data : $("#Form").serialize(),// 表单数据
type : "post",
dataType : "json",
success : function(data) {
var demoSet = [];

for (var i = 0; i < data.list_stu_dept.length; i++) {
demoSet.push([
JSON.parse(data.list_dept_avg_score[i]) ]);
}

$('#container')
.highcharts(
{
exporting : {
enabled : false
},
credits : {
enabled : false
},
chart : {
type : 'column'
},
title : {
text : ''
},
subtitle : {
text : ''
},
xAxis : {
categories : data.list_stu_dept
},
yAxis : {
min : 0,
title : {
text : '平均分'
},
allowDecimals : false
//是否允许刻度有小数
},
legend : {
enabled : false
},
tooltip : {
headerFormat : '<span style="font-size:10px">{point.key}</span><table>',
pointFormat : '<tr><td style="color:{series.color};padding:0">{series.name}: </td>'
+ '<td style="padding:0"><b>{point.y} 分</b></td></tr>',
footerFormat : '</table>',
shared : true,
useHTML : true
},
plotOptions : {
column : {
dataLabels : {
enabled : true, // dataLabels设为true


}
}
},


series : [ {
name : '平均分',
data : demoSet


} ]
});
}
});

}
0 0