index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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-12">
  19. <div class="ibox float-e-margins">
  20. <div class="ibox-title">
  21. <h5>今日数据分析</h5>
  22. </div>
  23. <div class="ibox-content">
  24. <div class="ibox-content" style="height: 350px" id="bar">
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="wrapper wrapper-content">
  32. <div class="row">
  33. </div>
  34. <div class="row">
  35. <div class="col-sm-12">
  36. <div class="ibox float-e-margins">
  37. <div style="display: flex;">
  38. <div class="ibox-title" style="width: 50%;">
  39. <h5>今日数据分析</h5>
  40. </div>
  41. <div class="ibox-title" style="width: 50%;">
  42. <h5>今日数据分析</h5>
  43. </div>
  44. </div>
  45. <div class="ibox-content no-padding" style="display: flex;">
  46. <div class="ibox-content" style="width: 50%;height: 350px" id="pie_evaluate">
  47. </div>
  48. <div class="ibox-content" style="width: 50%;height: 350px" id="pie_system">
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
  56. <script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  57. <script src="/static/admin/js/plugins/echarts/echarts.min.js"></script>
  58. <script type="text/javascript">
  59. var xData = {$xData};
  60. var chatData = {$chatData};
  61. var serviceData = {$serviceData};
  62. var evaluate = {$evaluate};
  63. var systemCount = {$systemCount};
  64. // 基于准备好的dom,初始化echarts实例
  65. var myChart_bar = echarts.init(document.getElementById('bar'));
  66. var pie_evaluate = echarts.init(document.getElementById('pie_evaluate'));
  67. var pie_system = echarts.init(document.getElementById('pie_system'));
  68. // 指定图表的配置项和数据
  69. var option_bar = {
  70. color: ['#1da1f2', '#fa7070', '#fcbb07', '#90dd75', '#8fa6ec', '#157efb'],
  71. tooltip: {
  72. trigger: 'axis',
  73. axisPointer: {
  74. type: 'shadow'
  75. }
  76. },
  77. legend: {
  78. itemWidth: 20, //图例的宽度
  79. itemHeight: 8, //图例的高度
  80. itemGap: 40,
  81. left: '55',
  82. top: 'top',
  83. icon: 'rect',
  84. //selectedMode: false, //取消图例上的点击事件
  85. data: ['会话量', '消息量'],
  86. },
  87. grid: {
  88. left: '30',
  89. right: '30',
  90. bottom: '20',
  91. containLabel: true
  92. },
  93. toolbox: {
  94. show: true,
  95. orient: 'vertical',
  96. left: 'right',
  97. top: 'center',
  98. },
  99. calculable: true,
  100. xAxis: [{
  101. splitLine: {
  102. show: false
  103. }, //去除网格线
  104. splitArea: {
  105. show: false
  106. }, //保留网格区域
  107. axisLine: {
  108. show: true,
  109. lineStyle: { //轴上的线样式
  110. color: '#979797',
  111. width: 0.6, //这里是为了突出显示加上的
  112. },
  113. },
  114. axisTick: {
  115. show: false
  116. },
  117. axisLabel: { //轴上的数据样式
  118. color: '#393C40',
  119. },
  120. data: xData,
  121. }],
  122. yAxis: [{
  123. // type: 'value',
  124. splitLine: {
  125. show: false
  126. }, //去除网格线
  127. splitArea: {
  128. show: false
  129. }, //保留网格区域
  130. axisLine: {
  131. show: true,
  132. lineStyle: { //轴上的线样式
  133. color: '#979797',
  134. width: 0.6, //这里是为了突出显示加上的
  135. },
  136. },
  137. axisTick: {
  138. show: false
  139. },
  140. axisLabel: { //轴上的数据样式
  141. color: '#393C40',
  142. }
  143. }],
  144. series: [
  145. {
  146. name: '会话量',
  147. type: 'bar',
  148. barWidth: 24,// 柱形的宽度
  149. barGap: 0,
  150. data: serviceData
  151. },
  152. {
  153. name: '消息量',
  154. type: 'bar',
  155. barWidth: 24,// 柱形的宽度
  156. barGap: 0,
  157. data: chatData
  158. }
  159. ]
  160. };
  161. // 使用刚指定的配置项和数据显示图表。
  162. myChart_bar.setOption(option_bar);
  163. // 指定图表的配置项和数据
  164. var option_PE = {
  165. backgroundColor: '#fff',
  166. tooltip: {
  167. trigger: 'item',
  168. formatter: "{b} : {c} ({d}%)"
  169. },
  170. visualMap: {
  171. show: false,
  172. min: 500,
  173. max: 600,
  174. inRange: {
  175. //colorLightness: [0, 1]
  176. }
  177. },
  178. series: [{
  179. name: '满意度',
  180. type: 'pie',
  181. radius: '50%',
  182. center: ['50%', '50%'],
  183. color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  184. data: [
  185. {
  186. value: evaluate['evaluateGood'],
  187. name: '满意'
  188. }, {
  189. value: evaluate['evaluateSecondary'],
  190. name: '一般'
  191. }, {
  192. value: evaluate['evaluateBad'],
  193. name: '不满意'
  194. }, {
  195. value: evaluate['evaluateNo'],
  196. name: '未评价'
  197. }
  198. ].sort(function(a, b) {
  199. return a.value - b.value
  200. }),
  201. roseType: 'radius',
  202. label: {
  203. normal: {
  204. formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
  205. rich: {
  206. c: {
  207. color: 'rgb(241,246,104)',
  208. fontSize: 20,
  209. fontWeight:'bold',
  210. lineHeight: 5
  211. },
  212. b: {
  213. color: 'rgb(98,137,169)',
  214. fontSize: 15,
  215. height: 40
  216. },
  217. },
  218. }
  219. },
  220. labelLine: {
  221. normal: {
  222. lineStyle: {
  223. color: 'rgb(98,137,169)',
  224. },
  225. smooth: 0.2,
  226. length: 10,
  227. length2: 20,
  228. }
  229. },
  230. itemStyle: {
  231. normal: {
  232. shadowColor: 'rgba(0, 0, 0, 0.8)',
  233. shadowBlur: 50,
  234. }
  235. }
  236. }]
  237. };
  238. var option_PS = {
  239. backgroundColor: '#fff',
  240. tooltip: {
  241. trigger: 'item',
  242. formatter: "{b} : {c} ({d}%)"
  243. },
  244. visualMap: {
  245. show: false,
  246. min: 500,
  247. max: 600,
  248. inRange: {
  249. //colorLightness: [0, 1]
  250. }
  251. },
  252. series: [{
  253. name: '满意度',
  254. type: 'pie',
  255. radius: '50%',
  256. center: ['50%', '50%'],
  257. color: ['rgb(131,249,103)', '#FBFE27', '#FE5050', '#1DB7E5'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  258. data: systemCount.sort(function(a, b) {
  259. return a.value - b.value
  260. }),
  261. roseType: 'radius',
  262. label: {
  263. normal: {
  264. formatter: ['{c|{c}次}', '{b|{b}}'].join('\n'),
  265. rich: {
  266. c: {
  267. color: 'rgb(241,246,104)',
  268. fontSize: 20,
  269. fontWeight:'bold',
  270. lineHeight: 5
  271. },
  272. b: {
  273. color: 'rgb(98,137,169)',
  274. fontSize: 15,
  275. height: 40
  276. },
  277. },
  278. }
  279. },
  280. labelLine: {
  281. normal: {
  282. lineStyle: {
  283. color: 'rgb(98,137,169)',
  284. },
  285. smooth: 0.2,
  286. length: 10,
  287. length2: 20,
  288. }
  289. },
  290. itemStyle: {
  291. normal: {
  292. shadowColor: 'rgba(0, 0, 0, 0.8)',
  293. shadowBlur: 50,
  294. }
  295. }
  296. }]
  297. };
  298. // 使用刚指定的配置项和数据显示图表。
  299. pie_evaluate.setOption(option_PE);
  300. pie_system.setOption(option_PS);
  301. </script>
  302. </body>
  303. </html>