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

101 lines
4.5 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<script>
var ctx = document.getElementById("Chat1_2").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: [
<%
String i_text = "";
String h_text = "";
String ih_text = "";
int call_max_t = 20;
String sql_t = "select t.* from ( select a.c_name, a.c_no ";
sql_t = sql_t + " ,( select count(c_no) from tbl_comment where c_member_type = 1 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 >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_hc ";
sql_t = sql_t + " ,( select count(c_no) from tbl_comment where c_member_type = 1 and c_use = 0 and c_project_no = b.c_project_no and c_type= 1 and c_member_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_ic ";
sql_t = sql_t + " ,( select count(c_no) from tbl_comment where c_member_type = 1 and c_use = 0 and c_project_no = b.c_project_no and c_type= 2 and c_member_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_pc ";
sql_t = sql_t + " ,( select count(c_no) from tbl_comment where c_member_type = 1 and c_use = 0 and c_project_no = b.c_project_no and c_type in (0,1,2) and c_member_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_tc ";
sql_t = sql_t + " from tbl_member a ";
sql_t = sql_t + " 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 = 1 and b.c_use = 0";
sql_t = sql_t + " where a.c_use = 0 ) t ";
sql_t = sql_t + " order by t.c_name asc ";
ResultSet rs_team = stmt2.executeQuery(sql_t);
int t_i = 0;
while(rs_team.next()){
t_i = t_i + 1;
i_text = i_text + rs_team.getInt("c_hc")+ ", ";
h_text = h_text + rs_team.getInt("c_ic")+ ", ";
if(call_max_t < rs_team.getInt("c_hc")){
call_max_t = rs_team.getInt("c_hc");
}
if(call_max_t < rs_team.getInt("c_ic")){
call_max_t = rs_team.getInt("c_ic");
}
%>
"<%=rs_team.getString("c_name")%>",
<%
}
rs_team.close();
int temp_call = call_max_t / 10;
temp_call = temp_call * 10;
call_max_t = temp_call + 10;
%>
],
datasets: [{
label: 'Hypothesis Comment',
data: [<%=i_text%>],
// fill: false,
backgroundColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(242,107,33,0.6)',
<%}%>
],
borderColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(242,107,33,1)',
<%}%>
],
borderWidth: 1
}, {
label: 'Interview Comment',
data: [<%=h_text%>],
// fill: false,
backgroundColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(37,169,224,0.6)',
<%}%>
],
borderColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(37,169,224,1)',
<%}%>
],
borderWidth: 1
} ],
},
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: "top",
align: "end"
}
}
});
</script>