warningstatisticaltopPieFrame.jsp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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="<%=request.getContextPath()%>/resource/js/highcharts/highcharts.src.js" type="text/javascript"></script>
  8. <script src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts-more.js"> </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="querywarningStatisticalPie.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,data[i].totalhours];
  31. xaixs.push(jsonObj1);
  32. }
  33. }
  34. showChart(xaixs);
  35. },
  36. error:function(er){
  37. alert("error2");
  38. alert(er);
  39. },
  40. exception:function(ex){
  41. //alert(ex);
  42. }
  43. });
  44. });
  45. function showChart(xc) {
  46. chart=new Highcharts.Chart({
  47. chart: {
  48. renderTo:'container',
  49. plotBackgroundColor: null,
  50. plotBorderWidth: null,
  51. plotShadow: false
  52. },
  53. title: {
  54. text: '报警频率统计分析'
  55. },
  56. tooltip: {
  57. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  58. },
  59. plotOptions: {
  60. pie: {
  61. allowPointSelect: true,
  62. cursor: 'pointer',
  63. dataLabels: {
  64. enabled: false,
  65. color: '#000000',
  66. connectorColor: '#000000',
  67. format: '<b>{point.name}</b>: {point.percentage:.1f} %'
  68. },
  69. showInLegend: true
  70. }
  71. },
  72. legend: {
  73. layout: 'vertical',
  74. align: 'right',
  75. verticalAlign: 'middle',
  76. borderWidth: 0
  77. },
  78. series: [{
  79. type: 'pie',
  80. name: '比率',
  81. data: xc
  82. }]
  83. });
  84. }
  85. </script>
  86. </head>
  87. <body>
  88. <div id="container" style=" height: 400px"></div>
  89. </body>