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

116 lines
4.6 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<script>
var ctx = document.getElementById("Chat1_1").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_team = " select a.c_no, a.c_team_name ";
sql_team = sql_team + " ,( select count(c_no) from tbl_interview where c_use = 0 and c_team_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_i ";
sql_team = sql_team + " ,( select count(c_no) from tbl_hypo where c_use = 0 and c_team_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_h ";
sql_team = sql_team + " ,( select count(c_no) from tbl_hypo_history where c_now = 2 and c_team_no = a.c_no and ( c_date >= '"+ p1_date +"' and c_date <= '"+ p2_date +"' ) ) as c_inv ";
sql_team = sql_team + " from tbl_team a where a.c_use = 0 and a.c_project_no = "+ session.getAttribute("member_project_no") + " order by a.c_team_name asc ";
ResultSet rs_team = stmt2.executeQuery(sql_team);
int t_i = 0;
while(rs_team.next()){
t_i = t_i + 1;
i_text = i_text + rs_team.getInt("c_i")+ ", ";
h_text = h_text + rs_team.getInt("c_h")+ ", ";
ih_text = ih_text + rs_team.getInt("c_inv")+ ", ";
if(call_max_t < rs_team.getInt("c_i")){
call_max_t = rs_team.getInt("c_i");
}
if(call_max_t < rs_team.getInt("c_h")){
call_max_t = rs_team.getInt("c_h");
}
if(call_max_t < rs_team.getInt("c_inv")){
call_max_t = rs_team.getInt("c_inv");
}
%>
"<%=rs_team.getString("C_team_name")%>",
<%
}
rs_team.close();
int temp_call = call_max_t / 10;
temp_call = temp_call * 10;
call_max_t = temp_call + 10;
%>
],
datasets: [{
label: 'Interview',
data: [<%=i_text%>],
// fill: false,
backgroundColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(249,214,4,0.6)',
<%}%>
],
borderColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(249,214,4,1)',
<%}%>
],
borderWidth: 1
}, {
label: 'Hypothesis',
data: [<%=h_text%>],
// fill: false,
backgroundColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(105,197,174,0.6)',
<%}%>
],
borderColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(105,197,174,1)',
<%}%>
],
borderWidth: 1
}, {
label: 'Invalidated Hypothesis',
data: [<%=ih_text%> ],
// fill: false,
backgroundColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(0,124,193,0.6)',
<%}%>
],
borderColor: [
<%for(int i = 1;i<t_i+1;i++){%>
'rgba(0,124,193,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>