investHome4.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. let app = new Vue({
  2. el: '#app',
  3. data () {
  4. return {
  5. time: '',
  6. timer: '',
  7. }
  8. },
  9. created () {
  10. this.time = formatDate()
  11. this.timer = setInterval(() => {
  12. this.time = formatDate()
  13. })
  14. },
  15. beforeDestroy () {
  16. if (this.timer) {
  17. clearInterval(this.timer);
  18. }
  19. },
  20. mounted () {
  21. setTimeout(() => {
  22. this.initChart1()
  23. this.initChart2()
  24. this.initChart3()
  25. this.initChart4()
  26. this.initChart5()
  27. })
  28. },
  29. methods: {
  30. format (percentage) {
  31. return '230.10亿'
  32. },
  33. initChart1 () {
  34. let myChart = echarts.init(this.$refs['echart1'])
  35. let option = {
  36. tooltip: {
  37. trigger: 'item',
  38. },
  39. legend: {
  40. bottom: '5%',
  41. orient: 'vertical',
  42. textStyle: {
  43. color: '#9DB9EB',
  44. },
  45. data: ['先进产能', '传统产能']
  46. },
  47. series: [
  48. {
  49. name: '',
  50. type: 'pie',
  51. radius: ['40%', '50%'],
  52. center: ['50%', '40%'],
  53. labelLine: {
  54. normal: {
  55. lineStyle: {
  56. width: 1,
  57. },
  58. },
  59. },
  60. data: [
  61. { value: 1048, name: '先进产能' },
  62. { value: 735, name: '传统产能' }
  63. ],
  64. itemStyle: {
  65. normal: {
  66. color: function (colors) {
  67. var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
  68. return colorList[colors.dataIndex];
  69. }
  70. },
  71. },
  72. label: {
  73. normal: {
  74. show: false,
  75. },
  76. },
  77. labelLine: {
  78. normal: {
  79. show: false
  80. }
  81. },
  82. },
  83. ],
  84. }
  85. myChart.setOption(option)
  86. tools.loopShowTooltip(myChart, option, {
  87. nterval: 10000,
  88. loopSeries: true,
  89. })
  90. },
  91. initChart2 () {
  92. let myChart = echarts.init(this.$refs['echart2'])
  93. option = {
  94. tooltip: {
  95. trigger: 'axis',
  96. axisPointer: {
  97. type: 'shadow',
  98. },
  99. },
  100. grid: {
  101. top: '15%',
  102. right: '10',
  103. left: '30',
  104. bottom: '10%',
  105. },
  106. xAxis: {
  107. data: ['2020', '2021', '2022'],
  108. axisLine: {
  109. show: true, //隐藏X轴轴线
  110. lineStyle: {
  111. color: '#005094',
  112. width: 1,
  113. },
  114. },
  115. axisTick: {
  116. show: true, //隐藏X轴刻度
  117. },
  118. axisLabel: {
  119. show: true,
  120. rotate: 15,
  121. textStyle: {
  122. color: 'rgba(255,255,255,0.6)', //X轴文字颜色
  123. fontSize: 12,
  124. },
  125. },
  126. },
  127. yAxis: [
  128. {
  129. name: '单位亿吨',
  130. type: 'value',
  131. nameTextStyle: {//y轴上方单位的颜色
  132. color: '#fff',
  133. fontSize: '10px'
  134. },
  135. splitLine: {
  136. show: true,
  137. lineStyle: {
  138. color: '#68b4dd66',
  139. type: 'dashed',
  140. },
  141. },
  142. axisLine: {
  143. show: false
  144. },
  145. axisLabel: {
  146. show: true,
  147. formatter: '{value}',
  148. textStyle: {
  149. color: 'rgba(250,250,250,0.6)',
  150. },
  151. },
  152. },
  153. ],
  154. series: [
  155. {
  156. name: '实际值',
  157. type: 'bar',
  158. barWidth: 15,
  159. itemStyle: {
  160. normal: {
  161. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  162. {
  163. offset: 0,
  164. color: '#69c0ff',
  165. },
  166. {
  167. offset: 1,
  168. color: '#082550',
  169. },
  170. ]),
  171. },
  172. },
  173. data: [70, 52, 33],
  174. }
  175. ],
  176. }
  177. myChart.setOption(option);
  178. tools.loopShowTooltip(myChart, option, {
  179. nterval: 2000,
  180. loopSeries: true,
  181. });
  182. },
  183. initChart3 () {
  184. let myChart = echarts.init(this.$refs['echart3'])
  185. let option = {
  186. tooltip: {
  187. trigger: 'item',
  188. },
  189. legend: {
  190. bottom: '5%',
  191. orient: 'vertical',
  192. textStyle: {
  193. color: '#9DB9EB',
  194. },
  195. data: ['先进产能', '传统产能']
  196. },
  197. series: [
  198. {
  199. name: '',
  200. type: 'pie',
  201. radius: ['40%', '50%'],
  202. center: ['50%', '40%'],
  203. labelLine: {
  204. normal: {
  205. lineStyle: {
  206. width: 1,
  207. },
  208. },
  209. },
  210. data: [
  211. { value: 1048, name: '先进产能' },
  212. { value: 735, name: '传统产能' }
  213. ],
  214. itemStyle: {
  215. normal: {
  216. color: function (colors) {
  217. var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
  218. return colorList[colors.dataIndex];
  219. }
  220. },
  221. },
  222. label: {
  223. normal: {
  224. show: false,
  225. },
  226. },
  227. labelLine: {
  228. normal: {
  229. show: false
  230. }
  231. },
  232. },
  233. ],
  234. }
  235. myChart.setOption(option)
  236. tools.loopShowTooltip(myChart, option, {
  237. nterval: 10000,
  238. loopSeries: true,
  239. })
  240. },
  241. initChart4 () {
  242. let myChart = echarts.init(this.$refs['echart4'])
  243. let option = {
  244. tooltip: {
  245. trigger: 'item',
  246. },
  247. legend: {
  248. bottom: '5%',
  249. orient: 'horizontal',
  250. textStyle: {
  251. color: '#9DB9EB',
  252. },
  253. data: ['产业转型', '数字化转型', '其他项目']
  254. },
  255. series: [
  256. {
  257. name: '',
  258. type: 'pie',
  259. radius: ['40%', '50%'],
  260. center: ['50%', '40%'],
  261. labelLine: {
  262. normal: {
  263. lineStyle: {
  264. width: 1,
  265. },
  266. },
  267. },
  268. data: [
  269. { value: 1048, name: '产业转型' },
  270. { value: 735, name: '数字化转型' },
  271. { value: 735, name: '其他项目' }
  272. ],
  273. itemStyle: {
  274. normal: {
  275. color: function (colors) {
  276. var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
  277. return colorList[colors.dataIndex];
  278. }
  279. },
  280. },
  281. label: {
  282. normal: {
  283. show: false,
  284. },
  285. },
  286. labelLine: {
  287. normal: {
  288. show: false
  289. }
  290. },
  291. },
  292. ],
  293. }
  294. myChart.setOption(option)
  295. tools.loopShowTooltip(myChart, option, {
  296. nterval: 10000,
  297. loopSeries: true,
  298. })
  299. },
  300. initChart5 () {
  301. let myChart = echarts.init(this.$refs['echart5'])
  302. let option = {
  303. tooltip: {
  304. trigger: 'item',
  305. },
  306. legend: {
  307. bottom: '5%',
  308. orient: 'horizontal',
  309. textStyle: {
  310. color: '#9DB9EB',
  311. },
  312. data: ['传统产业改造提升', '战略性新兴产业发展壮大']
  313. },
  314. series: [
  315. {
  316. name: '',
  317. type: 'pie',
  318. radius: ['40%', '50%'],
  319. center: ['50%', '40%'],
  320. labelLine: {
  321. normal: {
  322. lineStyle: {
  323. width: 1,
  324. },
  325. },
  326. },
  327. data: [
  328. { value: 1048, name: '传统产业改造提升' },
  329. { value: 735, name: '战略性新兴产业发展壮大' }
  330. ],
  331. itemStyle: {
  332. normal: {
  333. color: function (colors) {
  334. var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
  335. return colorList[colors.dataIndex];
  336. }
  337. },
  338. },
  339. label: {
  340. normal: {
  341. show: false,
  342. },
  343. },
  344. labelLine: {
  345. normal: {
  346. show: false
  347. }
  348. },
  349. },
  350. ],
  351. }
  352. myChart.setOption(option)
  353. tools.loopShowTooltip(myChart, option, {
  354. nterval: 10000,
  355. loopSeries: true,
  356. })
  357. },
  358. },
  359. })