fzjc_kongGuaRenKou.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. $(document).ready(function () {
  2. //辅助决策 人口统计 默认数据 - 空挂人口情况统计
  3. var isLoading = true;
  4. var temp = new Object();
  5. var kongGua = new Object();
  6. temp.kongGua = kongGua;
  7. kongGua.rkKongGuaYes = 0;
  8. kongGua.rkKongGuaNo = 0;
  9. kongGuaRenKou(temp, isLoading);
  10. feiFongGuaRenKou(temp, isLoading);
  11. var obj = new Object();
  12. $.ajax({
  13. url : prefix + "/queryRenKouKongGua",
  14. method : 'post',
  15. data : obj,
  16. success : function (e) {
  17. if(e.code == 0){
  18. e.kongGua = $.parseJSON(e.kongGua);
  19. isLoading = false;
  20. kongGuaRenKou(e, isLoading);
  21. feiFongGuaRenKou(e ,isLoading);
  22. }
  23. }
  24. });
  25. });
  26. function kongGuaRenKou(e, isLoading) {
  27. var rkKongGuaYes = e.kongGua.rkKongGuaYes;//空挂人口
  28. var rkKongGuaNo = e.kongGua.rkKongGuaNo;//非空挂人数
  29. var chartDom = document.getElementById('echarts_kgrk');
  30. var myChart = echarts.init(chartDom);
  31. if(!isLoading){
  32. myChart.on("click", function (e) {
  33. openDialog_kongGua(e.dataIndex);
  34. });
  35. }
  36. var colors0 = ['#177c3d', '#1c86b2', '#3043f2', '#3414d9'];
  37. var colors1 = ['#2dc94a', '#00ffcc', '#30b9f2', '#5519ff'];
  38. var option;
  39. option = {
  40. tooltip: {
  41. trigger: 'item'
  42. },
  43. series: [
  44. {
  45. name: '空挂人口',
  46. type: 'pie',
  47. radius: ['40%', '70%'],
  48. avoidLabelOverlap: false,
  49. label: {
  50. show: false,
  51. position: 'center'
  52. },
  53. emphasis: {
  54. label: {
  55. show: true,
  56. fontSize: '15',
  57. fontWeight: 'bold',
  58. color:'83bff6'
  59. }
  60. },
  61. labelLine: {
  62. show: false
  63. },
  64. itemStyle: {
  65. },
  66. data: [
  67. { value: rkKongGuaYes,
  68. name: '空挂人数' ,
  69. itemStyle: {
  70. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  71. offset: 0,
  72. color: '#1270d9'
  73. }, {
  74. offset: 1,
  75. color: '#00ffeb'
  76. }]),
  77. },
  78. },
  79. { value: rkKongGuaNo,
  80. name: '非空挂人数',
  81. itemStyle: {
  82. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  83. offset: 0,
  84. color: '#ff8404'
  85. }, {
  86. offset: 1,
  87. color: '#ffd904'
  88. }]),
  89. },
  90. }
  91. // { value: 27, name: 'Search Engine' },
  92. // { value: 5, name: 'Direct' }
  93. ]
  94. }
  95. ]
  96. };
  97. option && myChart.setOption(option);
  98. }
  99. function feiFongGuaRenKou(e, isLoading) {
  100. var rkKongGuaYes = e.kongGua.rkKongGuaYes;//空挂人口
  101. var rkKongGuaNo = e.kongGua.rkKongGuaNo;//非空挂人数
  102. var chartDom = document.getElementById('echarts_fkgrk');
  103. var myChart = echarts.init(chartDom);
  104. if(!isLoading){
  105. myChart.on("click", function (e) {
  106. openDialog_kongGua(1 - e.dataIndex);
  107. });
  108. }
  109. var option;
  110. option = {
  111. tooltip: {
  112. trigger: 'item'
  113. },
  114. series: [
  115. {
  116. name: '非空挂人数',
  117. type: 'pie',
  118. radius: ['40%', '70%'],
  119. avoidLabelOverlap: false,
  120. label: {
  121. show: false,
  122. position: 'center'
  123. },
  124. emphasis: {
  125. label: {
  126. show: true,
  127. fontSize: '15',
  128. fontWeight: 'bold',
  129. color:'83bff6'
  130. }
  131. },
  132. labelLine: {
  133. show: false
  134. },
  135. itemStyle: {
  136. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  137. // { offset: 0, color: '#83bff6' },
  138. // { offset: 0.5, color: '#70c573' },
  139. // { offset: 1, color: '#70c573' }
  140. // ])
  141. },
  142. data: [
  143. { value: rkKongGuaNo,
  144. name: '非空挂人数',
  145. itemStyle: {
  146. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  147. offset: 0,
  148. color: '#1270d9'
  149. }, {
  150. offset: 1,
  151. color: '#00ffeb'
  152. }]),
  153. }
  154. },
  155. { value: rkKongGuaYes,
  156. name: '空挂人数' ,
  157. itemStyle: {
  158. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  159. offset: 0,
  160. color: '#ff8404'
  161. }, {
  162. offset: 1,
  163. color: '#ffd904'
  164. }]),
  165. }
  166. }
  167. // { value: 27, name: 'Search Engine' },
  168. // { value: 5, name: 'Direct' }
  169. ]
  170. }
  171. ]
  172. };
  173. option && myChart.setOption(option);
  174. }
  175. function openDialog_kongGua(index) {//弹出对话框
  176. console.log(index+"=index")
  177. var title = index==0?'空挂人口统计':'非空挂人口统计';
  178. var url = prefix + "/rktj/kgrkqktj/" + index;
  179. $.modal.openDetailFull(title, url, 1200);
  180. }