<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="/pages/includes/taglibs.jsp" %>
<%
	String contextPath = request.getContextPath();
%>
<head>
 <script src="<%=contextPath %>/resource/js/jquery.min.js" type="text/javascript"></script>

<script src="<%=contextPath %>/resource/js/highcharts/highcharts.js" type="text/javascript"></script>


<script type="text/javascript">
	
	var chart;
	
	$(document).ready(function($){
	
				var type='<s:property value="type"/>';
			var windturbineid='<s:property value="windturbineid"/>';
			var beginDate='<s:property value="beginDate"/>';
			var endDate='<s:property value="endDate"/>';

			var url="querywarningStatisticalWtColumn.action?windturbineid="+windturbineid+"&beginDate="+beginDate+"&endDate="+endDate+"&type="+type;
			 
			 $.ajax({
			 	type:"post",
			 	url:url,
			 	dataType:"json",
			 	success:function(data){
				 
			 		if(data.length!=0){
			 			eval(data);
			 			var xaixs=[];
			 			var cc=[];
			 			var gc=[];
			 			var bc=[];
			 			var sc=[];
			 			var ic=[];
			 			for(var i=0;i<data.length;i+=1){
			 				
			 				var jsonObj1=[data[i].name];
			 				var obj2=[data[i].frequency];
			 				var obj3=[data[i].totalhours];

			 				xaixs.push(jsonObj1);
			 				cc.push(obj2);
			 			
			 			}
			 		}
			 		showChart(xaixs,cc,gc,bc);
			 	},
			 	error:function(er){
			 		alert("error1");
			 		alert(er);
			 	},
			 	exception:function(ex){
			 		//alert(ex);
			 	}		 	
			 });
	});
	
	
	
	
	
	
	function showChart(xc,cc,gc,bc) {
	
        chart=new Highcharts.Chart({
            chart: {
            	renderTo:'container',
                zoomType: 'xy'
            },
            title: {
                text: '报警数据统计分析'
            },
           
            xAxis: [{
                categories: xc,
                labels: {
                    rotation: -45,
                    align: 'right',
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif'
                    }
                }
            }],
            yAxis: [{ // Primary yAxis
                labels: {
                    format: '{value}次',
                    style: {
                       color: '#4572A7'
                    }
                },
                title: {
                    text: '频率',
                    style: {
                        color: '#4572A7'
                    }
                }
            }],
            tooltip: {
                shared: true
            },
          
            series: [{
                name: '报警频率',
                color: '#4572A7',
                type: 'column',
                data: cc,
                tooltip: {
                    valueSuffix: ' 次'
                }
    
            }]
            	 
        });
    }
</script>
</head>
<body>

	<div id="container" style=" height: 400px"></div>

</body>