智慧物业.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. var myChart = echarts.init(document.getElementById('amiddboxtbott2'));
  2. var wy_data = [];
  3. for (var i = 0; i < 5; i++) { // 五个类别 '物业', '电费', '停车', '燃气', '水费'
  4. var _data = [];
  5. for (var j = 0; j < 30; j++) {
  6. if (i === 0) { // 物业
  7. _data.push(2000 + randomNum(1900, 2100)); // 2000 * 30
  8. }
  9. if (i === 1) { // 电费
  10. _data.push(1333 + randomNum(1000, 1666)); // 2000 * 20
  11. }
  12. if (i === 2) { // 停车
  13. _data.push(10000 + randomNum(500, 2000)); // 1000 * 300
  14. }
  15. if (i === 3) { // 燃气
  16. _data.push(666 + randomNum(333, 999)); // 2000 * 10
  17. }
  18. if (i === 4) { // 水费
  19. _data.push(2000 + randomNum(500, 3500)); // 2000 * 30
  20. }
  21. }
  22. wy_data.push(_data);
  23. }
  24. option = {
  25. backgroundColor: 'rgba(1,202,217,.2)',
  26. grid: {
  27. left: 60,
  28. right: 50,
  29. top: 100,
  30. bottom: 25
  31. },
  32. title: [{
  33. top: 70,
  34. left: 150,
  35. textStyle: {
  36. fontSize: 14,
  37. color: 'rgba(255,255,255,.6)'
  38. },
  39. text: '物业月缴费金额统计'
  40. }],
  41. legend: [{
  42. top: 10,
  43. left: 20,
  44. textStyle: {
  45. fontSize: 10,
  46. color: 'rgba(255,255,255,.7)'
  47. },
  48. data: ['物业', '电费', '停车']
  49. }, {
  50. top: 30,
  51. left: 20,
  52. textStyle: {
  53. fontSize: 10,
  54. color: 'rgba(255,255,255,.7)'
  55. },
  56. data: ['燃气', '水费']
  57. }],
  58. xAxis: [{
  59. name: '日期',
  60. type: 'category',
  61. axisLine: {
  62. lineStyle: {
  63. color: 'rgba(255,255,255,.2)'
  64. }
  65. },
  66. splitLine: {
  67. lineStyle: {
  68. color: 'rgba(255,255,255,.1)'
  69. }
  70. },
  71. axisLabel: {
  72. color: "rgba(255,255,255,.7)"
  73. },
  74. data: ['6-01', '6-02', '6-03', '6-04', '6-05', '6-06', '6-07', '6-08', '6-09', '6-010',
  75. '6-11', '6-12', '6-13', '6-14', '6-15', '6-16', '6-17', '6-18', '6-19', '6-20',
  76. '6-21', '6-22', '6-23', '6-24', '6-25', '6-26', '6-27', '6-28', '6-29', '6-30'
  77. ],
  78. axisPointer: {
  79. type: 'shadow'
  80. }
  81. }],
  82. yAxis: [{
  83. // type: 'value',
  84. type: 'log',
  85. name: '金额 ¥',
  86. // interval: 50,
  87. axisLine: {
  88. lineStyle: {
  89. color: 'rgba(255,255,255,.3)'
  90. }
  91. },
  92. splitLine: {
  93. lineStyle: {
  94. color: 'rgba(255,255,255,.01)'
  95. }
  96. },
  97. }],
  98. series: [{
  99. name: '缴费占比',
  100. type: 'pie',
  101. radius: ['20%', '30%'],
  102. center: ['80%', '20%'],
  103. avoidLabelOverlap: true,
  104. minAngle: 30,
  105. label: {
  106. // show: false,
  107. position: 'inner',
  108. formatter: '{b} {d}%'
  109. },
  110. emphasis: {
  111. label: {
  112. show: true,
  113. fontSize: '30',
  114. fontWeight: 'bold'
  115. }
  116. },
  117. labelLine: {
  118. show: false
  119. },
  120. data: [
  121. { value: 300000, name: '停车', itemStyle: { color: '#edc1a5', opacity: 0.8, shadowBlur: 10, shadowOffsetX: 0, shadowOffsetY: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', } },
  122. { value: 65000, name: '物业', itemStyle: { color: '#bcd3bb', opacity: 0.8, shadowBlur: 10, shadowOffsetX: 0, shadowOffsetY: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', } },
  123. { value: 63000, name: '水费', itemStyle: { color: '#e1e8c8', opacity: 0.8, shadowBlur: 10, shadowOffsetX: 0, shadowOffsetY: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', } },
  124. { value: 42000, name: '电费', itemStyle: { color: '#e88f70', opacity: 0.8, shadowBlur: 10, shadowOffsetX: 0, shadowOffsetY: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', } },
  125. { value: 21000, name: '燃气', itemStyle: { color: '#9dc5c8', opacity: 0.8, shadowBlur: 10, shadowOffsetX: 0, shadowOffsetY: 0, shadowColor: 'rgba(0, 0, 0, 0.5)', } },
  126. ]
  127. },
  128. {
  129. name: '物业',
  130. type: 'line',
  131. data: wy_data[0],
  132. smooth: true,
  133. itemStyle: {
  134. color: '#bcd3bb',
  135. opacity: 0.8,
  136. shadowBlur: 10,
  137. shadowOffsetX: 0,
  138. shadowOffsetY: 0,
  139. shadowColor: 'rgba(0, 0, 0, 0.5)',
  140. }
  141. }, {
  142. name: '电费',
  143. type: 'line',
  144. data: wy_data[1],
  145. smooth: true,
  146. itemStyle: {
  147. color: '#e88f70',
  148. opacity: 0.8,
  149. shadowBlur: 10,
  150. shadowOffsetX: 0,
  151. shadowOffsetY: 0,
  152. shadowColor: 'rgba(0, 0, 0, 0.5)',
  153. }
  154. }, {
  155. name: '停车',
  156. type: 'line',
  157. data: wy_data[2],
  158. smooth: true,
  159. itemStyle: {
  160. color: '#edc1a5',
  161. opacity: 0.8,
  162. shadowBlur: 10,
  163. shadowOffsetX: 0,
  164. shadowOffsetY: 0,
  165. shadowColor: 'rgba(0, 0, 0, 0.5)',
  166. }
  167. }, {
  168. name: '燃气',
  169. type: 'line',
  170. data: wy_data[3],
  171. smooth: true,
  172. itemStyle: {
  173. color: '#9dc5c8',
  174. opacity: 0.8,
  175. shadowBlur: 10,
  176. shadowOffsetX: 0,
  177. shadowOffsetY: 0,
  178. shadowColor: 'rgba(0, 0, 0, 0.5)',
  179. }
  180. }, {
  181. name: '水费',
  182. type: 'line',
  183. data: wy_data[4],
  184. smooth: true,
  185. itemStyle: {
  186. color: '#e1e8c8',
  187. opacity: 0.8,
  188. shadowBlur: 10,
  189. shadowOffsetX: 0,
  190. shadowOffsetY: 0,
  191. shadowColor: 'rgba(0, 0, 0, 0.5)',
  192. }
  193. }
  194. ]
  195. };
  196. myChart.setOption(option);