<%-- 
    Document   : displayChart
    Created on : Aug 4, 2016, 8:07:48 PM
    Author     : 986137
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.io.*"%>
<%@page import="java.util.*"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
        <script src="js/Chart.bundle.js"></script>
        <script src="js/json3.js"></script>
        <script src="js/GenerateDashboard.js"></script>
        <%
                    String toDate, fromDate, distCode, reportSelection;

                    toDate = request.getParameter("toDate");
                    fromDate = request.getParameter("fromDate");
                    distCode = request.getParameter("distCode");
                    reportSelection = request.getParameter("reportSelection");
        %>
        <script  type="text/javascript">
            function doClick(evt){
                var activePoints = myBar.getElementAtEvent(evt);
                var datasetIndex = activePoints[0]._datasetIndex;
                var index = activePoints[0]._index;
                var bucket = window.saket.labels[index];
                var entity = window.saket.datasets[datasetIndex].label;
                alert(bucket + "-" + entity);
            }

            function doClick1(evt){

                var activePoints;

                activePoints = myPie2.getElementAtEvent(evt);


                var datasetIndex = activePoints[0]._datasetIndex;

                var index = activePoints[0]._index;
                var bucket = window.saket.labels[index];
                var entity = window.saket.datasets[datasetIndex].label;
                alert(bucket);

            }

            function ChartSelection(toDate,fromDate,distCode,reportSelection){

                if (reportSelection=="1"){
                    
                    PopulateBarChart(toDate,fromDate,distCode,reportSelection);
                }else if (reportSelection=="2"){

                    PopulateBarChart2(toDate,fromDate,distCode,reportSelection);
                }else if (reportSelection=="4"){

                    PopulateLineChart(toDate,fromDate,distCode,reportSelection);
                }else if (reportSelection=="5"){

                    PopulateLineChart2(toDate,fromDate,distCode,reportSelection);
                    
                }else if (reportSelection=="3"){

                    PopulateBarChart3(toDate,fromDate,distCode,reportSelection);
                    
                }else if (reportSelection=="6"){

                    PopulatePieChart(toDate,fromDate,distCode,reportSelection);
                }

            }




        </script>
    </head>
    <body onload="ChartSelection('<%=toDate%>','<%=fromDate%>','<%=distCode%>','<%=reportSelection%>')">
        <form name="generateChart"  method="post" action="">

            <canvas id="canvas" onclick="javascript:return doClick(event);"></canvas>
            <canvas id="canvas1" onclick="javascript:return doClick1(event);"></canvas>

        </form>
    </body>
    <style>
        canvas {
            -moz-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
        }
    </style>
</html>
