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

83 lines
2.1 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<script>
var ctx = document.getElementById("Chat2_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 a.c_no, a.c_team_name ";
for(int i = n_p1;i<n_p2+1;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 >= '"+ p_s_date[i] +"' and c_date <= '"+ p_e_date[i] +"' ) ) as c_h_" + i + " ";
}
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);
while(rs_team.next()){
t_i = t_i + 1;
if(t_i > 10){
t_i = 1;
}
%>
{
label: '<%=rs_team.getString("c_team_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>