insuranceCharts.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. var leftChart1 = function(options){
  2. var series0data = options.series[0].data || [];
  3. var xAxisData = options.xAxis[0].data;
  4. series0data = series0data.map(function(item){
  5. item = (Number(item)/10000).toFixed(2)
  6. return item;
  7. })
  8. var option = {
  9. "title": {
  10. "text": "医保支出费用月趋势",
  11. "x": "center",
  12. "textStyle": {
  13. color: ['#b5e1fc']
  14. },
  15. "padding": [15, 0, 0, 0]
  16. },
  17. "tooltip": {
  18. "trigger": "axis",
  19. formatter: function (v) {
  20. v = v[0]
  21. console.log(v)
  22. return '医保支出费用' + '\n' + v.value + '万元'
  23. }
  24. },
  25. grid: {
  26. top: 80,
  27. bottom: 30,
  28. left: 80
  29. },
  30. "yAxis": [{
  31. "type": "value",
  32. "name": "万元",
  33. nameTextStyle: {
  34. color: '#b5e1fc' // 坐标轴名称颜色
  35. },
  36. axisPointer: {
  37. type: 'shadow'
  38. },
  39. axisLine: {
  40. lineStyle: {
  41. color: '#095f8e'
  42. }
  43. },
  44. axisLabel: {
  45. color: '#b5e1fc'
  46. },
  47. splitLine: {
  48. lineStyle:{
  49. color:'#004b7a'
  50. },
  51. show:true // false不显示坐标轴刻度
  52. }
  53. }],
  54. "xAxis": [{
  55. "type": "category",
  56. axisPointer: {
  57. type: 'shadow'
  58. },
  59. axisTick: {
  60. // show: false
  61. },
  62. axisLine: {
  63. lineStyle: {
  64. color: '#004b7a'
  65. }
  66. },
  67. axisLabel: {
  68. color: '#b5e1fc'
  69. },
  70. nameTextStyle: {
  71. color: '#b5e1fc'
  72. },
  73. "data": xAxisData,
  74. }],
  75. "series": [{
  76. "smooth": true,
  77. "name": "万元",
  78. "type": "line",
  79. barWidth: 20,
  80. "label": {
  81. show: false,
  82. position: "right"
  83. },
  84. "itemStyle": {
  85. "normal": {
  86. "lineStyle": {
  87. "shadowColor": "rgba(0,0,0,0.4)"
  88. },
  89. barBorderRadius: [0, 8, 8, 0],
  90. color: '#03fa6c'
  91. }
  92. },
  93. "data": series0data
  94. }, ]
  95. }
  96. return option
  97. },
  98. leftChart2 = function(options){
  99. var title = options.title.text;
  100. var data = options.series[0].data;
  101. data = data.map(function(item){
  102. item.value = (Number(item.value)/10000).toFixed(2)
  103. return item;
  104. })
  105. var legend = data.map(function(item){
  106. return item.name;
  107. })
  108. var option = {
  109. "title": {
  110. "text": title,
  111. "x": "center",
  112. "textStyle": {
  113. color: ['#b5e1fc']
  114. },
  115. "padding": [15, 0, 0, 0]
  116. },
  117. "tooltip": {
  118. "trigger": "item",
  119. formatter: function (v) {
  120. return v.name + '\n' + v.value + '万元'
  121. }
  122. },
  123. legend: {
  124. orient: 'vertical',
  125. // x: 'right',
  126. data:legend,
  127. right: '45%',
  128. bottom: '50%',
  129. textStyle: {
  130. color: ['#b5e1fc']
  131. }
  132. },
  133. "series": [{
  134. "center": ["50%", "50%"],
  135. "radius": ['45%', '55%'],
  136. "name": "万元",
  137. "type": "pie",
  138. "itemStyle": {
  139. "normal": {
  140. "label": {
  141. "show": false
  142. },
  143. "labelLine": {
  144. "show": false
  145. }
  146. }
  147. },
  148. "data": data
  149. }],
  150. color : ["#00e6f3","#ff616f","#ff616f","#0fa5f2","#00e6f3"]
  151. }
  152. return option
  153. },
  154. leftChart3 = function(options){
  155. var title = options.title.text;
  156. var xAxisData = options.xAxis[0].data;
  157. var series0data = options.series[0].data || [];
  158. series0data = series0data.map(function(item){
  159. item = (Number(item)/10000).toFixed(2)
  160. return item;
  161. })
  162. var option = {
  163. "title": {
  164. "text": title,
  165. "x": "center",
  166. textStyle: {
  167. color: '#b5e1fc',
  168. fontSize: 16,
  169. fontWeight: 'bold'
  170. },
  171. "padding": [17, 0, 0, 0]
  172. },
  173. "tooltip": {
  174. "trigger": "axis",
  175. formatter: function (v) {
  176. v = v[0]
  177. return '医保支出费用' + '\n' + v.value + '万元'
  178. }
  179. },
  180. "grid": {
  181. top: '90',
  182. left: '70',
  183. bottom:'25',
  184. right:'40'
  185. },
  186. xAxis: [{
  187. type: 'category',
  188. "data": xAxisData,
  189. axisPointer: {
  190. type: 'shadow'
  191. },
  192. axisTick: {
  193. show: false
  194. },
  195. axisLine: {
  196. lineStyle: {
  197. color: '#095f8e'
  198. }
  199. },
  200. axisLabel: {
  201. color: '#b5e1fc'
  202. }
  203. }],
  204. yAxis: [{
  205. type: 'value',
  206. name: '万元',
  207. nameTextStyle: {
  208. color: '#b5e1fc' // 坐标轴名称颜色
  209. },
  210. splitLine: {
  211. show: false
  212. },
  213. axisLine: {
  214. lineStyle: {
  215. color: '#095f8e'
  216. }
  217. },
  218. axisLabel: {
  219. color: '#b5e1fc'
  220. }
  221. }
  222. ],
  223. series: [{
  224. name: '万元',
  225. type: 'bar',
  226. "data":series0data,
  227. barWidth: 20,
  228. label: {
  229. normal: {
  230. show: true,
  231. position: 'top', // 在柱状图上方显示
  232. color: '#fff' // 柱状图上方显示的数值颜色
  233. }
  234. },
  235. itemStyle: {
  236. barBorderRadius: [8, 8, 0, 0],
  237. color: '#00e6f3'
  238. }
  239. }
  240. ]
  241. }
  242. return option
  243. }