chartchannel.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <LINK rel="Bookmark" href="/favicon.ico" >
  10. <LINK rel="Shortcut Icon" href="/favicon.ico" />
  11. <script type="text/javascript">
  12. var ctx="${ctx}";
  13. </script>
  14. <!--[if lt IE 9]>
  15. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  16. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  17. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  18. <![endif]-->
  19. <link rel="stylesheet" href="${ctx}/assets/lib/bootstrap-3.3.7/css/bootstrap.min.css">
  20. <link rel="stylesheet" href="${ctx}/assets/lib/bootstrap-upload/css/default.css">
  21. <link rel="stylesheet" href="${ctx}/assets/lib/bootstrap-upload/css/fileinput.css">
  22. <script type="text/javascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.min.js"></script>
  23. <script type="text/javascript" src="${ctx}/assets/lib/jquery.form/jquery.form.min.js"></script>
  24. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  25. <script type="text/javascript" src="${ctx}/assets/lib/My97DatePicker/WdatePicker.js"></script>
  26. <script type="text/javascript" src="${ctx}/assets/lib/bootstrap-upload/js/fileinput.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/lib/bootstrap-upload/js/locales/zh.js"></script>
  28. <script type="text/javascript" src="${ctx}/assets/lib/bootstrap-3.3.7/js/bootstrap.min.js"></script>
  29. <!--请在下方写此页面业务相关的脚本-->
  30. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/third-party/highcharts/highcharts.js"></script>
  31. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/third-party/highcharts/modules/exporting.js"></script>
  32. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/third-party/highcharts/highcharts-zh_CN.js"></script>
  33. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  34. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/third-party/highcharts/sand-signika.js"></script>
  35. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  36. <style type="text/css">
  37. .margintop{margin-bottom:5px;}
  38. .placeholder{height:14px;}
  39. </style>
  40. <!--/请在上方写此页面业务相关的脚本-->
  41. <title>饼状图显示</title>
  42. <meta name="keywords" content="">
  43. <meta name="description" content="">
  44. </head>
  45. <body style="line-height:1;">
  46. <div id="container1" style="width:0px;height:420px;margin-top: 8%;margin-left: 2.5%;float: left;"></div>
  47. <div id="container" style="width:0px;height:420px;margin-top: 8%;margin-left: 50%;float: left;"></div>
  48. <script>
  49. $(function(){
  50. selectData();
  51. });
  52. //获取后台数据
  53. function selectData(){
  54. //定义数据用于接收数据
  55. var arr = [];
  56. var arr1 = [];
  57. //调用查询,加载数据
  58. var strAppealBeginDate='${AppealDateBegin}';
  59. var strAppealEndDate='${AppealDateEnd}';
  60. var strValidState='${ValidState}';
  61. var strTitle='${ReportType}';
  62. //定义一个索引,便于加载完成后关闭加载动画
  63. var index = "";
  64. $.ajax({
  65. type: "post",
  66. //同步调用,不显示默认为异步
  67. async: false,
  68. url: "${ctx}/myconsole/complaint/report/gettransact?AppealDateBegin="+strAppealBeginDate+"&AppealDateEnd="+strAppealEndDate+"&ValidState="+strValidState+"&ReportType="+strTitle,
  69. dataType:"json",
  70. //弹出加载动画
  71. beforeSend: function () {
  72. index = layer.msg('加载中...', {
  73. icon: 16 ,shade: 0.05
  74. });
  75. },
  76. success: function(dataSource){
  77. var data = dataSource.data;
  78. var data1 = dataSource.data1;
  79. //定义一个数组 ,迭代,把异步获取的数据放到数组中 当前月份数据
  80. for(var i=0;i<data.length;i++){
  81. for(var key in data[i]){
  82. arr.push({"name":key,"y":parseInt(data[i][key])});
  83. }
  84. }
  85. //定义一个数组 ,迭代,把异步获取的数据放到数组中 1月份到当前月份数据
  86. for(var i=0;i<data1.length;i++){
  87. for(var key in data1[i]){
  88. arr1.push({"name":key,"y":parseInt(data1[i][key])});
  89. }
  90. }
  91. //当前月份报表
  92. GetData(arr);
  93. //一月份到当前月份报表
  94. GetData1(arr1);
  95. },
  96. //关闭加载动画
  97. complete: function () {
  98. setTimeout("layer.close("+index+")", 1000 );
  99. },
  100. });
  101. };
  102. function GetData(arr){
  103. $('#container1').highcharts({
  104. chart: {
  105. plotBackgroundColor: "white",//设置绘图区背景色
  106. plotBorderWidth: null,//设置绘图区高度
  107. plotShadow: false//是否设置阴影
  108. },
  109. title: {
  110. text: '${AppealDateBegin}'+'月'+'${ReportName}',
  111. style:{
  112. color: "#000000",
  113. fontSize: "20px",
  114. fontFamily: "宋体"
  115. }
  116. },
  117. credits: {
  118. enabled: false
  119. },
  120. exporting:{
  121. filename:"保险消费投诉受理数量",
  122. },
  123. tooltip: {
  124. formatter: function() {
  125. return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +'% ('+
  126. Highcharts.numberFormat(this.y, 0, ',') +' 个)';
  127. }
  128. },
  129. plotOptions: {
  130. pie: {
  131. allowPointSelect: true,
  132. cursor: 'pointer',
  133. dataLabels: {
  134. enabled: true,
  135. formatter: function() {
  136. return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +'% ('+
  137. Highcharts.numberFormat(this.y, 0, ',') +' 个)';
  138. }
  139. },
  140. showInLegend: true
  141. }
  142. },
  143. series: [{
  144. type: 'pie',
  145. name: '所占比例',
  146. data: arr
  147. }]
  148. });
  149. };
  150. function GetData1(arr){
  151. $('#container').highcharts({
  152. chart: {
  153. plotBackgroundColor: "white",//设置绘图区背景色
  154. plotBorderWidth: null,//设置绘图区高度
  155. plotShadow: false//是否设置阴影
  156. },
  157. title: {
  158. text: '${StartDate}'+'${ReportName}',
  159. style:{
  160. color: "#000000",
  161. fontSize: "20px",
  162. fontFamily: "宋体"
  163. }
  164. },
  165. credits: {
  166. enabled: false
  167. },
  168. exporting:{
  169. filename:"保险消费投诉受理数量",
  170. //url:'http://localhost:8080/HighChartsDemo/SaveAsImage'//这里是一个重点哦,也可以修改exporting.js中对应的url
  171. },
  172. tooltip: {
  173. formatter: function() {
  174. return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +'% ('+
  175. Highcharts.numberFormat(this.y, 0, ',') +' 个)';
  176. }
  177. },
  178. plotOptions: {
  179. pie: {
  180. allowPointSelect: true,
  181. cursor: 'pointer',
  182. dataLabels: {
  183. enabled: true,
  184. formatter: function() {
  185. return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +'% ('+
  186. Highcharts.numberFormat(this.y, 0, ',') +' 个)';
  187. }
  188. },
  189. showInLegend: true
  190. }
  191. },
  192. series: [{
  193. type: 'pie',
  194. name: '所占比例',
  195. data: arr
  196. }]
  197. });
  198. };
  199. </script>
  200. </body>
  201. </html>