warningstatisticaltopWtColumnFrame.jsp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp" %>
  3. <%
  4. String contextPath = request.getContextPath();
  5. %>
  6. <head>
  7. <script src="<%=contextPath %>/resource/js/jquery.min.js" type="text/javascript"></script>
  8. <script src="<%=contextPath %>/resource/js/highcharts/highcharts.js" type="text/javascript"></script>
  9. <script type="text/javascript">
  10. var chart;
  11. $(document).ready(function($){
  12. var type='<s:property value="type"/>';
  13. var windturbineid='<s:property value="windturbineid"/>';
  14. var beginDate='<s:property value="beginDate"/>';
  15. var endDate='<s:property value="endDate"/>';
  16. var url="querywarningStatisticalWtColumn.action?windturbineid="+windturbineid+"&beginDate="+beginDate+"&endDate="+endDate+"&type="+type;
  17. $.ajax({
  18. type:"post",
  19. url:url,
  20. dataType:"json",
  21. success:function(data){
  22. if(data.length!=0){
  23. eval(data);
  24. var xaixs=[];
  25. var cc=[];
  26. var gc=[];
  27. var bc=[];
  28. var sc=[];
  29. var ic=[];
  30. for(var i=0;i<data.length;i+=1){
  31. var jsonObj1=[data[i].name];
  32. var obj2=[data[i].frequency];
  33. var obj3=[data[i].totalhours];
  34. xaixs.push(jsonObj1);
  35. cc.push(obj2);
  36. }
  37. }
  38. showChart(xaixs,cc,gc,bc);
  39. },
  40. error:function(er){
  41. alert("error1");
  42. alert(er);
  43. },
  44. exception:function(ex){
  45. //alert(ex);
  46. }
  47. });
  48. });
  49. function showChart(xc,cc,gc,bc) {
  50. chart=new Highcharts.Chart({
  51. chart: {
  52. renderTo:'container',
  53. zoomType: 'xy'
  54. },
  55. title: {
  56. text: '报警数据统计分析'
  57. },
  58. xAxis: [{
  59. categories: xc,
  60. labels: {
  61. rotation: -45,
  62. align: 'right',
  63. style: {
  64. fontSize: '13px',
  65. fontFamily: 'Verdana, sans-serif'
  66. }
  67. }
  68. }],
  69. yAxis: [{ // Primary yAxis
  70. labels: {
  71. format: '{value}次',
  72. style: {
  73. color: '#4572A7'
  74. }
  75. },
  76. title: {
  77. text: '频率',
  78. style: {
  79. color: '#4572A7'
  80. }
  81. }
  82. }],
  83. tooltip: {
  84. shared: true
  85. },
  86. series: [{
  87. name: '报警频率',
  88. color: '#4572A7',
  89. type: 'column',
  90. data: cc,
  91. tooltip: {
  92. valueSuffix: ' 次'
  93. }
  94. }]
  95. });
  96. }
  97. </script>
  98. </head>
  99. <body>
  100. <div id="container" style=" height: 400px"></div>
  101. </body>