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