<%--
 * Copyright by Intland Software
 *
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Intland Software. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Intland.
 *
 * $Revision$ $Date$
--%>

<%@ taglib uri="jstl-c" prefix="c" %>
<%@ taglib uri="jstl-fmt" prefix="fmt" %>

<%@ taglib uri="struts-html" prefix="html" %>


<%@ taglib uri="charttaglib" prefix="chart" %>

<%@ page import="com.intland.codebeamer.persistence.dto.TrackerLayoutLabelDto"%>

<%
	pageContext.setAttribute("CATEGORY_LABEL_ID", new Integer(TrackerLayoutLabelDto.CATEGORY_LABEL_ID));
%>

<chart:query name="bugsByLabel" var="data">
	<chart:param name="proj_id" value="-1" />
	<chart:param name="status_closed" value="${STATUS_CLOSED}" />
	<chart:param name="label_id" value="${CATEGORY_LABEL_ID}" />
	<chart:param name="bug_tracker" value="${BUG_TRACKER}" />
	<chart:param name="userTrackers" value="${userTrackers}" className="java.util.ArrayList" />
	<chart:param name="startDate">
		<fmt:formatDate value="${startDate}" pattern="${formatDatePattern}" />
	</chart:param>
	<chart:param name="closeDate">
		<fmt:formatDate value="${closeDate}" pattern="${formatDatePattern}" />
	</chart:param>
</chart:query>

<%-- Create Chart --%>
<chart:create var="chart" type="stackedbar" width="${whtd}" height="${hght}"
	tooltips="true" legend="true" title="Bugs by Category"
	yaxisLabel="Number of Bugs" xaxisLabel="Category">

	<chart:dataset type="category" value="${data}"
		categoryProperties="label_name"
		seriesLabels="Open;Closed"
		valueProperties="open_count;closed_count" />

	<chart:axis createIntegerTickUnits="true" labelAngle="6.0" />

	<chart:renderer series="0" paint="red" />
	<chart:renderer series="1" paint="blue" />

</chart:create>

<%-- (See CMU/SEI-92-TR-25 document’s Page 208) --%>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">

<TR>
	<%-- Display the Chart --%>
	<TD WIDTH="<c:out value="${chart.width}" />"
		HEIGHT="<c:out value="${chart.height}" />"><html:img alt="Chart" border="0"
		width="${chart.width}" height="${chart.height}" usemap="#${chart.id}"
		page="/writeChart?id=${chart.id}" /></TD>
</TR>
<TR>
	<TD WIDTH="<c:out value="${chart.width}" />">
		<span class="subtext">(Number of Open and Closed Bugs by Category.)</span>
	</TD>
</TR>

<c:out value="${lineBreak}" escapeXml="false" />

</TABLE>
