4.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div id="myChartold4" style="width: 100%; height: 100%; "></div>
  3. </template>
  4. <script>
  5. export default {
  6. //老年人能力评估统计
  7. name: "OldPersonAbilityCount",
  8. data() {
  9. return {
  10. dataArr: [
  11. { label: '完全自理', value: 25 },
  12. { label: '半失能', value: 38 },
  13. { label: '失能', value: 37 }
  14. ],
  15. colorArr: [
  16. { color1: '#ff0900', color2: '#ff7367' },
  17. { color1: '#4625FF', color2: '#6DC0FF' },
  18. { color1: '#f6a314', color2: '#f4ff81' }
  19. ]
  20. }
  21. },
  22. mounted() {
  23. const seriesArr = [{
  24. type: 'pictorialBar',
  25. symbol: `image://${require('../../assets/oldStatistics/r.png')}`,
  26. symbolSize: [53, 68],
  27. data: [{ value: 200, symbolPosition: 'center', symbolOffset: [0, 0]}],
  28. z: 2
  29. }];
  30. seriesArr.push({
  31. type: 'pie',
  32. radius: [70,85], //内部经 外半径
  33. center: ['30%', '50%'],
  34. clockwise: false,
  35. labelLine: {
  36. show: false
  37. },
  38. data: [{
  39. name: '失能',
  40. value: this.dataArr[2].value,
  41. label: {
  42. show: false
  43. },
  44. itemStyle: {
  45. color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  46. offset: 0,
  47. color: this.colorArr[2].color1
  48. }, {
  49. offset: 1,
  50. color: this.colorArr[2].color2
  51. }])
  52. }
  53. },
  54. {
  55. name: '半失能',
  56. value: this.dataArr[1].value,
  57. label: {
  58. show: false
  59. },
  60. itemStyle: {
  61. color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  62. offset: 0,
  63. color: this.colorArr[1].color1
  64. }, {
  65. offset: 1,
  66. color: this.colorArr[1].color2
  67. }])
  68. }
  69. },
  70. {
  71. value: 100 - this.dataArr[1].value - this.dataArr[2].value,
  72. itemStyle: {
  73. color: "transparent"
  74. }
  75. }],
  76. z: 2
  77. });
  78. seriesArr.push({
  79. name: '完全自理',
  80. type: 'pie',
  81. radius: [70, 85], //内部经 外半径
  82. center: ['30%', '49%'],
  83. clockwise: true,
  84. labelLine: {
  85. show: false
  86. },
  87. data: [{
  88. value: this.dataArr[0].value,
  89. itemStyle: {
  90. color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  91. offset: 0,
  92. color: this.colorArr[0].color1
  93. }, {
  94. offset: 1,
  95. color: this.colorArr[0].color2
  96. }])
  97. }
  98. },
  99. {
  100. value: 100 - this.dataArr[0].value,
  101. itemStyle: {
  102. color: "transparent"
  103. }
  104. }],
  105. z: 2
  106. });
  107. seriesArr.push({
  108. type: 'pie',
  109. radius: [97, 100], //内部经 外半径
  110. center: ['30%', '49%'],
  111. clockwise: true,
  112. labelLine: {
  113. show: false
  114. },
  115. data: [{
  116. name: '完全自理',
  117. value: this.dataArr[0].value,
  118. label: {
  119. show: false
  120. },
  121. itemStyle: {
  122. color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
  123. offset: 0,
  124. color: this.colorArr[0].color1
  125. }, {
  126. offset: 1,
  127. color: this.colorArr[0].color2
  128. }])
  129. }
  130. },
  131. {
  132. value: 100 - this.dataArr[0].value,
  133. itemStyle: {
  134. color: "transparent"
  135. }
  136. }],
  137. z: 2
  138. });
  139. let myChart = this.$echarts.init(document.getElementById('myChartold4'));
  140. myChart.setOption(
  141. {
  142. grid:{
  143. right:"50%",
  144. },
  145. color: [this.colorArr[0].color1, this.colorArr[1].color1, this.colorArr[2].color1],
  146. legend: {
  147. show: true,
  148. orient: 'vertical',
  149. top: 'middle',
  150. right: '220',
  151. itemGap: 70,
  152. itemWidth: 13,
  153. itemHeight: 13,
  154. data: ['完全自理', '半失能', '失能'],
  155. textStyle: {
  156. color: 'white',
  157. },
  158. },
  159. xAxis: {
  160. type: 'category',
  161. splitLine: {
  162. show: false
  163. },
  164. axisLine: {
  165. show: false
  166. },
  167. axisLabel: {
  168. show: false
  169. },
  170. axisTick: {
  171. show: false
  172. }
  173. },
  174. yAxis: {
  175. type: 'value',
  176. max: 200,
  177. splitLine: {
  178. show: false
  179. },
  180. axisLine: {
  181. show: false
  182. },
  183. axisTick: {
  184. show: false
  185. },
  186. axisLabel: {
  187. show: false
  188. }
  189. },
  190. series: seriesArr
  191. }
  192. );
  193. }
  194. }
  195. </script>
  196. <style scoped>
  197. </style>