task4EvaluateRptDemo.jsp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@include file="/context/mytags.jsp"%>
  4. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8">
  8. <title>Demo</title>
  9. <!-- 引入echarts文件 -->
  10. <script src="plug-in/echarts/echarts.js"></script>
  11. <link type="text/css" href="css/stats.css" rel="stylesheet" />
  12. <%-- <script src="plug-in/jquery-1.7.2.js"></script> --%>
  13. </head>
  14. <body>
  15. <div id="main" style="width: 90%; height: 60%;"></div>
  16. <script type="text/javascript">
  17. // alert("1.准备初始化echarts实例");
  18. // 基于准备好的dom,初始化echarts实例
  19. var myChart = echarts.init(document.getElementById('main'));
  20. var posList = [
  21. 'left', 'right', 'top', 'bottom',
  22. 'inside',
  23. 'insideTop', 'insideLeft', 'insideRight', 'insideBottom',
  24. 'insideTopLeft', 'insideTopRight', 'insideBottomLeft', 'insideBottomRight'
  25. ];
  26. myChart.configParameters = {
  27. rotate: {
  28. min: -90,
  29. max: 90
  30. },
  31. align: {
  32. options: {
  33. left: 'left',
  34. center: 'center',
  35. right: 'right'
  36. }
  37. },
  38. verticalAlign: {
  39. options: {
  40. top: 'top',
  41. middle: 'middle',
  42. bottom: 'bottom'
  43. }
  44. },
  45. position: {
  46. options: echarts.util.reduce(posList, function (map, pos) {
  47. map[pos] = pos;
  48. return map;
  49. }, {})
  50. },
  51. distance: {
  52. min: 0,
  53. max: 100
  54. }
  55. };
  56. myChart.config = {
  57. rotate: 90,
  58. align: 'left',
  59. verticalAlign: 'middle',
  60. position: 'insideBottom',
  61. distance: 15,
  62. onChange: function () {
  63. var labelOption = {
  64. normal: {
  65. rotate: app.config.rotate,
  66. align: app.config.align,
  67. verticalAlign: app.config.verticalAlign,
  68. position: app.config.position,
  69. distance: app.config.distance
  70. }
  71. };
  72. myChart.setOption({
  73. series: [{
  74. label: labelOption
  75. }, {
  76. label: labelOption
  77. }, {
  78. label: labelOption
  79. }, {
  80. label: labelOption
  81. }]
  82. });
  83. }
  84. };
  85. var labelOption = {
  86. normal: {
  87. show: true,
  88. position: myChart.config.position,
  89. distance: myChart.config.distance,
  90. align: myChart.config.align,
  91. verticalAlign: myChart.config.verticalAlign,
  92. rotate: myChart.config.rotate,
  93. formatter: '{c} {name|{a}}',
  94. fontSize: 16,
  95. rich: {
  96. name: {
  97. textBorderColor: '#fff'
  98. }
  99. }
  100. }
  101. };
  102. var option = {
  103. title : {
  104. text: '项目工作评价统计',
  105. subtext: '技术支持:上海鼎善信息科技有限公司',
  106. x: 'center'
  107. },
  108. color: ['#e5323e', '#006699', '#003366', '#4cabce'],
  109. tooltip: {
  110. trigger: 'axis',
  111. axisPointer: {
  112. type: 'shadow'
  113. } ,
  114. formatter: function(params) {
  115. var result = params[0].name+"工作评价统计</br>";
  116. params.forEach(function (item) {
  117. result += item.marker + " " + item.seriesName + "率 : " + item.value +"%</br>";
  118. });
  119. return result;
  120. }
  121. /* formatter: "{b} <br/>{a0}率: {c0}% <br/> {a1}率: {c1}%" */
  122. },
  123. legend: {
  124. data: ['差评', '良好'],
  125. x: 'right'
  126. },
  127. toolbox: {
  128. show: true,
  129. orient: 'vertical',
  130. left: 'right',
  131. top: 'center',
  132. feature: {
  133. mark: {show: true},
  134. dataView: {show: true, readOnly: false},
  135. magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
  136. restore: {show: true},
  137. saveAsImage: {show: true}
  138. }
  139. },
  140. calculable: true,
  141. xAxis : [ {
  142. type : 'category',
  143. axisTick : {
  144. show : false
  145. },
  146. data : [ '嘉定新图', '工业园区', '市环境中心', '检察院', '大众工业学校', '交大附中',
  147. '群艺馆', '中小企业', '浦阳阁', '行政服务中心', '特保大队', '民防', '科创',
  148. '青东法庭', '新城', '规土', '行政窗口', '就促', '考培', '建交委' ],
  149. axisLabel : {//坐标轴刻度标签的相关设置。
  150. clickable : true,//并给图表添加单击事件 根据返回值判断点击的是哪里
  151. interval : 0,
  152. rotate:"45"
  153. /* formatter : function(params, index) {
  154. if (index % 2 != 0) {
  155. return '\n\n' + params;
  156. } else {
  157. return params;
  158. }
  159. } */
  160. }
  161. } ],
  162. yAxis : [ {
  163. type : 'value',
  164. name:'单位:%',
  165. axisLabel:{formatter:'{value} %'}
  166. } ],
  167. series : [
  168. {
  169. name : '差评',
  170. type : 'bar',
  171. barGap : 0,
  172. label : labelOption,
  173. data : [ 2, 1, 4, 3, 2, 5, 2, 2, 2, 1, 1, 2, 3, 2, 4,
  174. 1, 2, 5, 1, 1 ]
  175. },
  176. {
  177. name : '良好',
  178. type : 'bar',
  179. label : labelOption,
  180. data : [ 24, 52, 34, 42, 12, 21, 12, 24, 32, 42, 12,
  181. 23, 13, 42, 36, 24, 34, 28, 17, 18 ]
  182. } ]
  183. };
  184. myChart.setOption(option);
  185. // 相当于 document.ready,{代码}
  186. $(function() {
  187. //alert("3.页面加载完毕");
  188. })
  189. </script>
  190. </body>
  191. </html>