Aucune description

trafficData.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. trafficDataChart('timeTraffic', daySeatName, callDate, callDate[0])
  2. $('.btn_time').click(function(e) {
  3. if(e.target.tagName == 'SPAN') {
  4. if($(e.target).attr('data-state') == '1') {
  5. $('.daySeat').css('display', 'none')
  6. $('.timeTraffic').css('display', 'inline-block')
  7. $('#traffic').css('display', 'none')
  8. $('#timeTraffic').css('display', 'block')
  9. $(this).siblings(".act").children("label").attr("indexTitle", "日话务数据统计1")
  10. // $(".act").attr("indexTitle","日话务数据统计1")
  11. $('.call_situation h2').text('话务数据统计')
  12. trafficDataChart('timeTraffic', ['登陆坐席数量1', '呼叫排队数量1', '话务量1', '呼入接通量1'], callDate, callDate[0])
  13. trafficState = 0
  14. }
  15. }
  16. e.stopPropagation();
  17. })
  18. function trafficDataChart(dom, data, count, count1, rotate = 0) {
  19. let hotThings = echarts.init(document.getElementById("timeTraffic"));
  20. console.log(hotThings)
  21. window.onresize = function() {
  22. hotThings.resize()
  23. }
  24. const labelOption = {
  25. show: true,
  26. rotate: 90,
  27. align: 'left',
  28. verticalAlign: 'middle',
  29. position: 'insideBottom',
  30. //distance: 15,
  31. //formatter: '{c} {name|{a}}',
  32. formatter: () => {
  33. console.log('{c}', 'c')
  34. },
  35. //fontSize: 16,
  36. rich: {
  37. name: {}
  38. }
  39. // normal: {
  40. // formatter: function(params) {
  41. // // 可以打印自己看一下, 其实params就是每根柱子的对象
  42. // console.info(params);
  43. // var html = '';
  44. // if (params.value > 0) {
  45. // // 千万不要html += '';
  46. // html = params.value + '次 ' + params.seriesName;
  47. // return html;
  48. // }
  49. // // 没有数据的返回'' 不是返回0
  50. // return html;
  51. // },
  52. // }
  53. };
  54. option = {
  55. // tooltip: {
  56. // trigger: 'axis',
  57. // axisPointer: {
  58. // type: 'shadow'
  59. // },
  60. // },
  61. tooltip: {
  62. trigger: 'item',
  63. // trigger: 'axis',
  64. show: true,
  65. // 进行数据处理
  66. formatter: function(params) {
  67. console.log(params, 'params')
  68. var html = '';
  69. if(params.value > 0) {
  70. html += params.marker;
  71. if(params.name.indexOf('率') >= 0) {
  72. html += params.seriesName + ': ' + params.value + '%<br/>';
  73. } else {
  74. html += params.seriesName + ': ' + params.value + '<br/>';
  75. }
  76. }
  77. return html;
  78. }
  79. },
  80. // legend: {
  81. // textStyle: {
  82. // fontSize: 12, //字体大小
  83. // color: '#ffffff' //字体颜色
  84. // },
  85. // lineStyle: {
  86. // color: '#ffffff'
  87. // }
  88. // },
  89. grid: {
  90. left: '3%',
  91. right: '4%',
  92. bottom: '15%',
  93. containLabel: true
  94. },
  95. xAxis: [{
  96. type: 'category',
  97. axisLine: {
  98. lineStyle: {
  99. color: '#ffffff'
  100. }
  101. },
  102. axisLabel: {
  103. show: true,
  104. rotate: -30, // 角度值:Number
  105. fontSize: 11, // 顺便调小一点字体大小
  106. textStyle: {
  107. color: '#ffffff'
  108. }
  109. },
  110. data: ['呼入量\r\n 接通量', '呼入接通率', '呼出量\r\n 呼出接通量', '呼出接通率']
  111. }],
  112. yAxis: [{
  113. type: 'value',
  114. axisLine: {
  115. lineStyle: {
  116. color: '#ffffff'
  117. }
  118. },
  119. // interval: 5,
  120. // splitLine:{ show:false} ,
  121. // axisLine: {show: false},
  122. // axisTick: {show: false}
  123. },
  124. {
  125. type: 'value',
  126. axisLine: {
  127. lineStyle: {
  128. color: '#ffffff'
  129. }
  130. },
  131. splitLine: {
  132. show: false
  133. },
  134. min: 0,
  135. max: 100,
  136. axisLabel: {
  137. formatter: '{value} 100%'
  138. }
  139. }
  140. ],
  141. series: [{
  142. name: '呼入量',
  143. type: 'bar',
  144. barGap: 0,
  145. label: labelOption,
  146. emphasis: {
  147. focus: 'series'
  148. },
  149. data: [320, 332, 301, 334]
  150. },
  151. {
  152. name: '未接通回拨量',
  153. type: 'bar',
  154. stack: 'Ad',
  155. label: labelOption,
  156. emphasis: {
  157. focus: 'series'
  158. },
  159. data: [120, 0, 191, 0]
  160. },
  161. {
  162. name: '自助接通量',
  163. type: 'bar',
  164. stack: 'Ad',
  165. label: labelOption,
  166. emphasis: {
  167. focus: 'series'
  168. },
  169. data: [220, 0, 0, 0]
  170. },
  171. {
  172. name: '人工接通',
  173. type: 'bar',
  174. stack: 'Ad',
  175. label: labelOption,
  176. emphasis: {
  177. focus: 'series'
  178. },
  179. data: [150, 0, 0, 0]
  180. }
  181. ]
  182. };
  183. hotThings.setOption(option);
  184. }