c-innovacion2/resoft/cms_for_bcb/process/leaderboard/chart4_1.jsp

86 lines
2.4 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<script>
var ctx = document.getElementById("Chat4_1").getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [
<%for(int i = n_p1;i<n_p2+1;i++){%>
"Period <%=i%>",
<%}%>
],
datasets: [
<%
int call_max_t = 20;
int t_i = 0;
String sql_team = " select t.* from ( select a.c_name, a.c_no ";
for(int i = n_p1;i<n_p2+1;i++){
sql_team = sql_team +" ,( select count(c_no) from tbl_comment where c_member_type = 2 and c_use = 0 and c_project_no = b.c_project_no and c_type= 0 and c_member_no = a.c_no and ( c_date >= '"+ p_s_date[i] +"' and c_date <= '"+ p_e_date[i] +"' ) ) as c_h_" + i + " ";
}
sql_team = sql_team + " from tbl_member a ";
sql_team = sql_team + " inner join tbl_pnm_for_bcb b on b.c_member_no = a.c_no and b.c_project_no = " + session.getAttribute("member_project_no") + " and b.c_type = 2 and b.c_use = 0";
sql_team = sql_team + " where a.c_use = 0 ) t ";
sql_team = sql_team + " order by t.c_name asc ";
ResultSet rs_team = stmt2.executeQuery(sql_team);
while(rs_team.next()){
t_i = t_i + 1;
if(t_i > 10){
t_i = 1;
}
%>
{
label: '<%=rs_team.getString("c_name")%>',
data: [
<%for(int i = n_p1;i<n_p2+1;i++){
if(call_max_t < rs_team.getInt("c_h_"+i)){
call_max_t = rs_team.getInt("c_h_"+i);
}
%>
<%=rs_team.getInt("c_h_"+i)%>,
<%}%>
],
fill: false,
backgroundColor: chartColors.color0,
borderColor: chartColors.color<%=t_i%>,
borderWidth: 2
},
<%
}
rs_team.close();
int temp_call = call_max_t / 10;
temp_call = temp_call * 10;
call_max_t = temp_call + 10;
%>
],
},
options: {
maintainAspectRatio: false, // default value. false일 경우 포함된 div의 크기에 맞춰서 그려짐.
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 10,
min: 0,
max: <%=call_max_t%>,
fontSize: 14,
}
}]
},
elements: {
},
legend: {
position: "right",
align: "end"
}
}
});
</script>