resident-analysis-charts.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. var labelBottom = {
  2. normal: {
  3. label: {
  4. show: false,
  5. },
  6. labelLine: {
  7. show: false
  8. }
  9. }
  10. };
  11. var jiaoFeiChart = null,
  12. healthChart = null,
  13. serviceChart = null,
  14. sexChart = null,
  15. ageChart = null;
  16. //缴费情况
  17. function jiaoFeiData(yiJiaoFeiData, weiJiaoFeiData) {
  18. jiaoFeiChart = echarts.init(document.getElementById('jiaoFeiChart'));
  19. var jiaoFeiOptions = {
  20. color: ['#12b7f5', '#FFC800'],
  21. series: [{
  22. type: 'pie',
  23. radius: ['50%', '70%'],
  24. center: ['50%', '50%'], //饼图的位置
  25. data: [{
  26. name: '已缴费人数',
  27. value: yiJiaoFeiData,
  28. itemStyle: {
  29. normal: {
  30. label: {
  31. show: false,
  32. },
  33. labelLine: {
  34. show: false
  35. }
  36. }
  37. }
  38. },
  39. {
  40. name: '未缴费人数',
  41. value: weiJiaoFeiData,
  42. itemStyle: {
  43. normal: {
  44. label: {
  45. show: true,
  46. position: 'center',
  47. color: '#666',
  48. formatter: function(params) {
  49. return '缴费情况\n分析';
  50. }
  51. },
  52. labelLine: {
  53. show: false
  54. }
  55. }
  56. }
  57. }
  58. ]
  59. }]
  60. };
  61. jiaoFeiChart.clear();
  62. jiaoFeiChart.setOption(jiaoFeiOptions);
  63. }
  64. //健康分布
  65. function healthData(jkrqdata, hbrqdata, gwrqdata, hfqrqdata, wbzdata) {
  66. healthChart = echarts.init(document.getElementById('healthChart'));
  67. var healthOptions = {
  68. color: ['#12B7F5', '#FB5DAB', '#CD67FD', '#FFC800', '#61EB41'],
  69. series: [{
  70. type: 'pie',
  71. radius: ['50%', '70%'],
  72. center: ['25%', '50%'], //饼图的位置
  73. data: [{
  74. name: '健康人群',
  75. value: jkrqdata,
  76. itemStyle: {
  77. normal: {
  78. label: {
  79. show: true,
  80. position: 'center',
  81. color: '#666',
  82. formatter: function(params) {
  83. return '健康分布\n分析';
  84. }
  85. },
  86. labelLine: {
  87. show: false
  88. }
  89. }
  90. }
  91. },
  92. {
  93. name: '患病人群',
  94. value: hbrqdata,
  95. itemStyle: labelBottom
  96. },
  97. {
  98. name: '高危人群',
  99. value: gwrqdata,
  100. itemStyle: labelBottom
  101. },
  102. {
  103. name: '恢复期人群',
  104. value: hfqrqdata,
  105. itemStyle: labelBottom
  106. },
  107. {
  108. name: '未标注',
  109. value: wbzdata,
  110. itemStyle: labelBottom
  111. }
  112. ]
  113. }]
  114. };
  115. healthChart.clear();
  116. healthChart.setOption(healthOptions);
  117. }
  118. //服务分布
  119. function serviceData(arr) {
  120. serviceChart = echarts.init(document.getElementById('serviceChart'));
  121. var serviceOptions = option = {
  122. calculable: true,
  123. grid: {
  124. y: 25,
  125. y2: 30,
  126. x: 20,
  127. x2: 20,
  128. borderColor: '#ffffff'
  129. },
  130. xAxis: [{
  131. type: 'category',
  132. axisLine: {
  133. show: true,
  134. lineStyle: {
  135. color: '#dcdcdc',
  136. width: 1
  137. }
  138. },
  139. axisTick: {
  140. show: false
  141. },
  142. axisLabel: {
  143. show: true,
  144. color: '#666'
  145. },
  146. splitArea: {
  147. show: false
  148. },
  149. splitLine: {
  150. show: false
  151. },
  152. data: ['普通人群', '老年人', '高血压', '糖尿病']
  153. }],
  154. yAxis: [{
  155. type: 'value',
  156. axisLine: {
  157. show: true,
  158. lineStyle: {
  159. color: '#dcdcdc',
  160. width: 1
  161. }
  162. },
  163. axisTick: {
  164. show: false
  165. },
  166. axisLabel: {
  167. show: false
  168. },
  169. splitArea: {
  170. show: false
  171. },
  172. splitLine: {
  173. show: false
  174. },
  175. axisLabel: {
  176. show: false
  177. }
  178. }],
  179. series: [{
  180. name: '服务分布比例',
  181. type: 'bar',
  182. barWidth: 20,
  183. itemStyle: {
  184. normal: {
  185. color: function(params) {
  186. var colorList = ['#12B7F5', '#61eb41', '#CD67FD', '#fb5dab'];
  187. return colorList[params.dataIndex]
  188. },
  189. label: {
  190. show: true,
  191. position: 'top',
  192. color: '#666',
  193. formatter: function(params) {
  194. return params.value + '%';
  195. }
  196. },
  197. barBorderRadius: 0
  198. }
  199. },
  200. data: arr
  201. }]
  202. };
  203. serviceChart.clear();
  204. serviceChart.setOption(serviceOptions);
  205. }
  206. //性别情况
  207. function sexData(femaleData, maleData) {
  208. sexChart = echarts.init(document.getElementById('sexChart'));
  209. var sexOptions = {
  210. color: ['#12B7F5', '#FB5DAB'],
  211. series: [{
  212. type: 'pie',
  213. radius: ['50%', '70%'],
  214. center: ['50%', '50%'], //饼图的位置
  215. data: [{
  216. name: '男性',
  217. value: maleData,
  218. itemStyle: {
  219. normal: {
  220. label: {
  221. show: true,
  222. position: 'center',
  223. color: '#666',
  224. formatter: function(params) {
  225. return '性别情况\n分析';
  226. }
  227. },
  228. labelLine: {
  229. show: false
  230. }
  231. }
  232. }
  233. },
  234. {
  235. name: '女性',
  236. value: femaleData,
  237. itemStyle: labelBottom
  238. }
  239. ]
  240. }]
  241. };
  242. sexChart.clear();
  243. sexChart.setOption(sexOptions);
  244. }
  245. //年龄分布
  246. function ageData(arr) {
  247. ageChart = echarts.init(document.getElementById('ageChart'));
  248. var ageOptions = {
  249. calculable: true,
  250. grid: {
  251. y: 25,
  252. y2: 30,
  253. x: 20,
  254. x2: 20,
  255. borderColor: '#ffffff'
  256. },
  257. xAxis: [{
  258. type: 'category',
  259. axisLine: {
  260. show: true,
  261. lineStyle: {
  262. color: '#dcdcdc',
  263. width: 1
  264. }
  265. },
  266. axisTick: {
  267. show: false
  268. },
  269. axisLabel: {
  270. show: true,
  271. color: '#666'
  272. },
  273. splitArea: {
  274. show: false
  275. },
  276. splitLine: {
  277. show: false
  278. },
  279. data: ['0-6岁', '7-18岁', '19-30岁', '31-50岁', '51-64岁', '65岁以上']
  280. }],
  281. yAxis: [{
  282. type: 'value',
  283. axisLine: {
  284. show: true,
  285. lineStyle: {
  286. color: '#dcdcdc',
  287. width: 1
  288. }
  289. },
  290. axisTick: {
  291. show: false
  292. },
  293. axisLabel: {
  294. show: false
  295. },
  296. splitArea: {
  297. show: false
  298. },
  299. splitLine: {
  300. show: false
  301. },
  302. axisLabel: {
  303. show: false
  304. }
  305. }],
  306. series: [{
  307. name: '年龄分布比例',
  308. type: 'bar',
  309. barWidth: 40,
  310. itemStyle: {
  311. normal: {
  312. color: function(params) {
  313. var colorList = ['#12B7F5', '#FB5DAB', '#CD67FD', '#FFC800', '#61EB41', '#909090'];
  314. return colorList[params.dataIndex]
  315. },
  316. label: {
  317. show: true,
  318. position: 'top',
  319. formatter: function(params) {
  320. return params.value;
  321. }
  322. },
  323. barBorderRadius: 0
  324. }
  325. },
  326. data: arr
  327. }]
  328. };
  329. ageChart.clear();
  330. ageChart.setOption(ageOptions);
  331. }
  332. window.onresize = function() {
  333. jiaoFeiChart.resize();
  334. healthChart.resize();
  335. serviceChart.resize();
  336. sexChart.resize();
  337. ageChart.resize();
  338. }