warningstatisticaltopColumnFrame.jsp 2.8 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 wfid='<s:property value="wfId"/>';
  13. var beginDate='<s:property value="beginDate"/>';
  14. var endDate='<s:property value="endDate"/>';
  15. var url="querywarningStatisticalColumn.action?wfId="+wfid+"&beginDate="+beginDate+"&endDate="+endDate;
  16. $.ajax({
  17. type:"post",
  18. url:url,
  19. dataType:"json",
  20. success:function(data){
  21. if(data.length!=0){
  22. eval(data);
  23. var xaixs=[];
  24. var cc=[];
  25. var gc=[];
  26. var bc=[];
  27. var sc=[];
  28. var ic=[];
  29. for(var i=0;i<data.length;i+=1){
  30. var jsonObj1=[data[i].name];
  31. var obj2=[data[i].frequency];
  32. var obj3=[data[i].totalhours];
  33. xaixs.push(jsonObj1);
  34. cc.push(obj2);
  35. gc.push(obj3);
  36. }
  37. }
  38. showChart(xaixs,cc,gc,bc,sc);
  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. align: 'right',
  62. style: {
  63. fontSize: '13px',
  64. fontFamily: 'Verdana, sans-serif'
  65. }
  66. }
  67. }],
  68. yAxis: [{ // Primary yAxis
  69. labels: {
  70. format: '{value}次',
  71. style: {
  72. color: '#4572A7'
  73. }
  74. },
  75. title: {
  76. text: '频率',
  77. style: {
  78. color: '#4572A7'
  79. }
  80. }
  81. }],
  82. tooltip: {
  83. shared: true
  84. },
  85. series: [{
  86. name: '报警频率',
  87. color: '#4572A7',
  88. type: 'column',
  89. yAxis: 0,
  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>