index.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>后台首页</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  9. <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  10. <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  11. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  12. </head>
  13. <body class="gray-bg">
  14. <div class="wrapper wrapper-content">
  15. <div class="row">
  16. </div>
  17. <div class="row">
  18. <div class="col-sm-8">
  19. <div class="ibox float-e-margins">
  20. <div class="ibox-title">
  21. <h5>今日数据分析</h5>
  22. </div>
  23. <div class="ibox-content no-padding">
  24. <div class="ibox-content" style="height: 350px" id="bar">
  25. </div>
  26. </div>
  27. <div class="ibox-content no-padding" style="display: flex;">
  28. <div class="ibox-content" style="width: 50%;height: 350px" id="pie_evaluate">
  29. </div>
  30. <div class="ibox-content" style="width: 50%;height: 350px" id="pie_luate">
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
  38. <script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  39. <script src="/static/admin/js/plugins/echarts/echarts.min.js"></script>
  40. <script type="text/javascript">
  41. var xData = {$xData};
  42. var chatData = {$chatData};
  43. var serviceData = {$serviceData};
  44. var evaluate = {$evaluate};
  45. // 基于准备好的dom,初始化echarts实例
  46. var myChart_bar = echarts.init(document.getElementById('bar'));
  47. var pie_evaluate = echarts.init(document.getElementById('pie_evaluate'));
  48. var pie_evalu = echarts.init(document.getElementById('pie_luate'));
  49. // 指定图表的配置项和数据
  50. var option_bar = {
  51. color: ['#1da1f2', '#fa7070', '#fcbb07', '#90dd75', '#8fa6ec', '#157efb'],
  52. tooltip: {
  53. trigger: 'axis',
  54. axisPointer: {
  55. type: 'shadow'
  56. }
  57. },
  58. legend: {
  59. itemWidth: 20, //图例的宽度
  60. itemHeight: 8, //图例的高度
  61. itemGap: 40,
  62. left: '55',
  63. top: 'top',
  64. icon: 'rect',
  65. //selectedMode: false, //取消图例上的点击事件
  66. data: ['会话量', '消息量'],
  67. },
  68. grid: {
  69. left: '30',
  70. right: '30',
  71. bottom: '20',
  72. containLabel: true
  73. },
  74. toolbox: {
  75. show: true,
  76. orient: 'vertical',
  77. left: 'right',
  78. top: 'center',
  79. },
  80. calculable: true,
  81. xAxis: [{
  82. splitLine: {
  83. show: false
  84. }, //去除网格线
  85. splitArea: {
  86. show: false
  87. }, //保留网格区域
  88. axisLine: {
  89. show: true,
  90. lineStyle: { //轴上的线样式
  91. color: '#979797',
  92. width: 0.6, //这里是为了突出显示加上的
  93. },
  94. },
  95. axisTick: {
  96. show: false
  97. },
  98. axisLabel: { //轴上的数据样式
  99. color: '#393C40',
  100. },
  101. data: xData,
  102. }],
  103. yAxis: [{
  104. // type: 'value',
  105. splitLine: {
  106. show: false
  107. }, //去除网格线
  108. splitArea: {
  109. show: false
  110. }, //保留网格区域
  111. axisLine: {
  112. show: true,
  113. lineStyle: { //轴上的线样式
  114. color: '#979797',
  115. width: 0.6, //这里是为了突出显示加上的
  116. },
  117. },
  118. axisTick: {
  119. show: false
  120. },
  121. axisLabel: { //轴上的数据样式
  122. color: '#393C40',
  123. }
  124. }],
  125. series: [
  126. {
  127. name: '会话量',
  128. type: 'bar',
  129. barWidth: 12,// 柱形的宽度
  130. barGap: 0,
  131. data: serviceData
  132. },
  133. {
  134. name: '消息量',
  135. type: 'bar',
  136. barWidth: 12,// 柱形的宽度
  137. barGap: 0,
  138. data: chatData
  139. }
  140. ]
  141. };
  142. // 使用刚指定的配置项和数据显示图表。
  143. myChart_bar.setOption(option_bar);
  144. // 指定图表的配置项和数据
  145. var option_PE = {
  146. backgroundColor: '#fff',
  147. tooltip: {
  148. trigger: 'item',
  149. formatter: "{b} : {c} ({d}%)"
  150. },
  151. visualMap: {
  152. show: false,
  153. min: 500,
  154. max: 600,
  155. inRange: {
  156. //colorLightness: [0, 1]
  157. }
  158. },
  159. series: [{
  160. name: '满意度',
  161. type: 'pie',
  162. radius: '50%',
  163. center: ['50%', '50%'],
  164. color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  165. data: [{
  166. value: evaluate['evaluateGood'],
  167. name: '满意'
  168. }, {
  169. value: evaluate['evaluateSecondary'],
  170. name: '一般'
  171. }, {
  172. value: evaluate['evaluateBad'],
  173. name: '不满意'
  174. }, {
  175. value: evaluate['evaluateNo'],
  176. name: '未评价'
  177. }
  178. ].sort(function(a, b) {
  179. return a.value - b.value
  180. }),
  181. roseType: 'radius',
  182. label: {
  183. normal: {
  184. formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
  185. rich: {
  186. c: {
  187. color: 'rgb(241,246,104)',
  188. fontSize: 20,
  189. fontWeight:'bold',
  190. lineHeight: 5
  191. },
  192. b: {
  193. color: 'rgb(98,137,169)',
  194. fontSize: 15,
  195. height: 40
  196. },
  197. },
  198. }
  199. },
  200. labelLine: {
  201. normal: {
  202. lineStyle: {
  203. color: 'rgb(98,137,169)',
  204. },
  205. smooth: 0.2,
  206. length: 10,
  207. length2: 20,
  208. }
  209. },
  210. itemStyle: {
  211. normal: {
  212. shadowColor: 'rgba(0, 0, 0, 0.8)',
  213. shadowBlur: 50,
  214. }
  215. }
  216. }]
  217. };
  218. // 使用刚指定的配置项和数据显示图表。
  219. pie_evaluate.setOption(option_PE);
  220. pie_evalu.setOption(option_PE);
  221. </script>
  222. </body>
  223. </html>