investHome5.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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. initChart1 () {
  31. let myChart = echarts.init(this.$refs['echart1'])
  32. let option = {
  33. tooltip: {
  34. formatter: data => {
  35. return `${data[0].name}<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[0].color.colorStops[0].color}"></span> ${data[0].seriesName}:${data[0].value}亿 <br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[1].color.colorStops[0].color}"></span> ${data[1].seriesName}:${data[1].value}亿`
  36. },
  37. trigger: 'axis',
  38. // axisPointer: {
  39. // type: 'cross',
  40. // },
  41. },
  42. grid: {
  43. top: '16%',
  44. right:'3%',
  45. left: '5%',
  46. bottom: '15%',
  47. },
  48. legend: {
  49. data: ["计划投资", "实际投资"],
  50. x:'center',
  51. y:'10px',
  52. textStyle: {
  53. color: 'rgba(250,250,250,0.6)',
  54. },
  55. },
  56. xAxis: {
  57. data: title.map(item=>item.name),
  58. axisLine: {
  59. show: true, //隐藏X轴轴线
  60. lineStyle: {
  61. color: '#005094',
  62. width: 1,
  63. },
  64. },
  65. axisTick: {
  66. show: false, //隐藏X轴刻度
  67. },
  68. axisLabel: {
  69. show: true,
  70. rotate: 40,
  71. textStyle: {
  72. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  73. },
  74. },
  75. },
  76. yAxis: [
  77. {
  78. type: 'value',
  79. name: '亿元',
  80. nameTextStyle: {
  81. color: 'rgba(255,255,255,0.6)',
  82. },
  83. splitLine: {
  84. show: true,
  85. lineStyle: {
  86. color: '#68b4dd66',
  87. type: 'dashed',
  88. },
  89. },
  90. axisLine: {
  91. show: true,
  92. lineStyle: {
  93. color: '#3D7495',
  94. },
  95. },
  96. axisLabel: {
  97. show: true,
  98. textStyle: {
  99. color: 'rgba(250,250,250,0.6)',
  100. },
  101. },
  102. },
  103. ],
  104. series: [
  105. {
  106. name: '计划投资',
  107. type: 'bar',
  108. barWidth: 10,
  109. itemStyle: {
  110. normal: {
  111. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  112. {
  113. offset: 0,
  114. color: '#69c0ff',
  115. },
  116. {
  117. offset: 1,
  118. color: '#082550',
  119. },
  120. ]),
  121. },
  122. },
  123. data: echartL1[0],
  124. },
  125. {
  126. name: '实际投资',
  127. type: 'bar',
  128. barWidth: 10,
  129. itemStyle: {
  130. normal: {
  131. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  132. {
  133. offset: 0,
  134. color: '#957DFF',
  135. },
  136. {
  137. offset: 1,
  138. color: '#082550',
  139. },
  140. ]),
  141. },
  142. },
  143. data: echartL1[1],
  144. },
  145. ],
  146. }
  147. myChart.setOption(option)
  148. tools.loopShowTooltip(myChart, option, {
  149. nterval: 2000,
  150. loopSeries: true,
  151. })
  152. },
  153. initChart2 () {
  154. let myChart = echarts.init(this.$refs['echart2'])
  155. let option = {
  156. title: {
  157. text: '固定资产',
  158. textStyle: {
  159. color: '#69C0FF',
  160. fontSize: 16,
  161. fontWeight: 500
  162. },
  163. top: '10',
  164. left: '10'
  165. },
  166. textStyle: {
  167. color: '#fff',
  168. },
  169. tooltip: {
  170. trigger: "axis",
  171. formatter: function (params) {
  172. var tip = params[0].axisValue + '<br/>' + params[0].marker + params[0].data[1] + ':' + params[0].data[2] + '个,' + params[0].data[3] + '亿元' + '<br/>' + params[1].marker + params[1].data[1] + ':' + params[1].data[2] + '个,' + params[1].data[3] + '亿元';
  173. return tip
  174. },
  175. axisPointer: {
  176. lineStyle: {
  177. type: 'dashed',
  178. width: 2,
  179. color: 'rgba(255,255,255,0.6)'
  180. },
  181. animation: true
  182. }
  183. },
  184. grid: {
  185. top: '25%',
  186. right: '5%',
  187. left: '15%',
  188. bottom: '15%',
  189. },
  190. yAxis: {
  191. data: ['备案', '特别监管'],
  192. splitLine: {
  193. show: true,
  194. lineStyle: {
  195. color: '#68b4dd66',
  196. type: 'dashed',
  197. },
  198. },
  199. axisLine: {
  200. show: false
  201. },
  202. axisLabel: {
  203. show: true,
  204. formatter: '{value}',
  205. textStyle: {
  206. color: 'rgba(250,250,250,0.6)',
  207. },
  208. },
  209. nameTextStyle: {
  210. color: '#ebf8ac',
  211. fontSize: 16,
  212. },
  213. },
  214. xAxis: {
  215. data: ['项目储备', '项目立项', '可研论证', '投资决策'],
  216. axisLine: {
  217. show: true, //隐藏X轴轴线
  218. lineStyle: {
  219. color: '#005094',
  220. width: 1,
  221. },
  222. },
  223. axisTick: {
  224. show: false, //隐藏X轴刻度
  225. },
  226. axisLabel: {
  227. show: true,
  228. textStyle: {
  229. color: 'rgba(255,255,255,0.6)', //X轴文字颜色
  230. fontSize: 12,
  231. },
  232. },
  233. },
  234. series: [
  235. {
  236. name: '特别监管',
  237. type: 'scatter',
  238. symbol: 'circle',//'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
  239. symbolSize: function (data) {
  240. return Math.sqrt(data[2]) * 3;
  241. },
  242. label: {
  243. emphasis: {
  244. show: true,
  245. formatter: function (param) {
  246. return param.data[2];
  247. },
  248. position: 'top'
  249. }
  250. },
  251. itemStyle: {
  252. normal: {
  253. color: '#40A9FF'
  254. }
  255. },
  256. data: [
  257. ['项目储备', '特别监管', 14, 12.05],
  258. ['项目立项', '特别监管', 2, 1.25],
  259. ['可研论证', '特别监管', 10, 32.69],
  260. ['投资决策', '特别监管', 15, 28.53],
  261. ]
  262. },
  263. {
  264. name: '备案',
  265. type: 'scatter',
  266. symbol: 'circle',//'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
  267. symbolSize: function (data) {
  268. return Math.sqrt(data[2]) * 3;
  269. },
  270. label: {
  271. emphasis: {
  272. show: true,
  273. formatter: function (param) {
  274. return param.data[2];
  275. },
  276. position: 'top'
  277. }
  278. },
  279. itemStyle: {
  280. normal: {
  281. color: '#45DAD1'
  282. }
  283. },
  284. data: [
  285. ['项目储备', '备案', 27, 23.86],
  286. ['项目立项', '备案', 1, 1.05],
  287. ['可研论证', '备案', 14, 18.46],
  288. ['投资决策', '备案', 40, 38.86],
  289. ]
  290. },
  291. ]
  292. }
  293. myChart.setOption(option)
  294. tools.loopShowTooltip(myChart, option, {
  295. nterval: 2000,
  296. loopSeries: true,
  297. })
  298. },
  299. initChart3 () {
  300. let myChart = echarts.init(this.$refs['echart3'])
  301. let option = {
  302. tooltip: {
  303. formatter: data => {
  304. return `${data[0].name}<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[0].color.colorStops[0].color}"></span> ${data[0].seriesName}:${data[0].value}亿 <br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[1].color.colorStops[0].color}"></span> ${data[1].seriesName}:${data[1].value}亿`
  305. },
  306. trigger: 'axis',
  307. // axisPointer: {
  308. // type: 'cross',
  309. // },
  310. },
  311. grid: {
  312. top: '16%',
  313. right:'3%',
  314. left: '10%',
  315. bottom: '25%',
  316. },
  317. legend: {
  318. data: ["计划投资", "实际投资"],
  319. x:'center',
  320. y:'10px',
  321. textStyle: {
  322. color: 'rgba(250,250,250,0.6)',
  323. },
  324. },
  325. xAxis: {
  326. data: title.map(item=>item.name),
  327. axisLine: {
  328. show: true, //隐藏X轴轴线
  329. lineStyle: {
  330. color: '#005094',
  331. width: 1,
  332. },
  333. },
  334. axisTick: {
  335. show: false, //隐藏X轴刻度
  336. },
  337. axisLabel: {
  338. show: true,
  339. rotate: 40,
  340. textStyle: {
  341. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  342. },
  343. },
  344. },
  345. yAxis: [
  346. {
  347. type: 'value',
  348. name: '亿元',
  349. nameTextStyle: {
  350. color: 'rgba(255,255,255,0.6)',
  351. },
  352. splitLine: {
  353. show: true,
  354. lineStyle: {
  355. color: '#68b4dd66',
  356. type: 'dashed',
  357. },
  358. },
  359. axisLine: {
  360. show: true,
  361. lineStyle: {
  362. color: '#3D7495',
  363. },
  364. },
  365. axisLabel: {
  366. show: true,
  367. textStyle: {
  368. color: 'rgba(250,250,250,0.6)',
  369. },
  370. },
  371. },
  372. ],
  373. series: [
  374. {
  375. name: '计划投资',
  376. type: 'bar',
  377. barWidth: 10,
  378. itemStyle: {
  379. normal: {
  380. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  381. {
  382. offset: 0,
  383. color: '#69c0ff',
  384. },
  385. {
  386. offset: 1,
  387. color: '#082550',
  388. },
  389. ]),
  390. },
  391. },
  392. data: echartL1[0],
  393. },
  394. {
  395. name: '实际投资',
  396. type: 'bar',
  397. barWidth: 10,
  398. itemStyle: {
  399. normal: {
  400. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  401. {
  402. offset: 0,
  403. color: '#957DFF',
  404. },
  405. {
  406. offset: 1,
  407. color: '#082550',
  408. },
  409. ]),
  410. },
  411. },
  412. data: echartL1[1],
  413. },
  414. ],
  415. }
  416. myChart.setOption(option)
  417. tools.loopShowTooltip(myChart, option, {
  418. nterval: 2000,
  419. loopSeries: true,
  420. })
  421. },
  422. initChart4 () {
  423. let myChart = echarts.init(this.$refs['echart4'])
  424. option = {
  425. title: {
  426. text: ''
  427. },
  428. legend: {
  429. data: ['类型1', '类型2', '类型3', '类型4', '类型5'],
  430. textStyle: {
  431. color: '#9DB9EB',
  432. },
  433. },
  434. splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
  435. show: true,
  436. areaStyle: { // 分隔区域的样式设置。
  437. color: ['yellow'],
  438. // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
  439. }
  440. },
  441. radar: {
  442. // shape: 'circle',
  443. center: ['50%', '60%'],
  444. radius: 40,
  445. indicator: [
  446. { name: '类型1', max: 100000 },
  447. { name: '类型2', max: 100000 },
  448. { name: '类型3', max: 100000 },
  449. { name: '类型4', max: 100000 },
  450. { name: '类型5', max: 100000 },
  451. ],
  452. axisLine: { // 设置雷达图中间射线的颜色
  453. lineStyle: {
  454. color: '#c0c0c0',
  455. },
  456. },
  457. splitLine: { //网格颜色设置
  458. show: true,
  459. lineStyle: {
  460. width: 1,
  461. color: '#1e83e4',
  462. },
  463. },
  464. splitArea: { //设置图表颜色,show的值为true
  465. show: false,
  466. areaStyle: {
  467. // color:"#c1ddf8", //一般设置方式
  468. //设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
  469. //a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
  470. //b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
  471. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  472. { offset: 0, color: '#c1ddf8' }, // 0% 处的颜色
  473. { offset: 1, color: '#1e83e4' }// 100% 处的颜色
  474. ], false)
  475. }
  476. }
  477. },
  478. series: [
  479. {
  480. name: '',
  481. type: 'radar',
  482. symbol: 'circle', // 单个数值点的样式,还可以取值'rect','angle'等
  483. symbolSize: 0, // 数值点的大小
  484. data: [
  485. {
  486. value: [4200, 3000, 20000, 35000, 50000, 18000],
  487. name: '类型1',
  488. itemStyle: { //该数值区域样式设置
  489. normal: {
  490. color: '#2CC6FF', //背景颜色,还需设置areaStyle
  491. lineStyle: {
  492. color: '#2CC6FF', //边框颜色
  493. },
  494. },
  495. },
  496. label: { //显示value中具体的数值
  497. normal: {
  498. show: false,
  499. textStyle: { //更改数值样式
  500. color: '#43EDE3'
  501. }
  502. },
  503. },
  504. areaStyle: { //设置区域背景颜色透明度
  505. normal: {
  506. width: 1,
  507. opacity: 0.8,
  508. },
  509. },
  510. },
  511. {
  512. value: [8000, 3000, 38000, 76000, 32000, 71000],
  513. name: '类型2',
  514. itemStyle: { //该数值区域样式设置
  515. normal: {
  516. color: '#D87AFF', //背景颜色,还需设置areaStyle
  517. lineStyle: {
  518. color: '#2CC6FF', //边框颜色
  519. },
  520. },
  521. },
  522. label: { //显示value中具体的数值
  523. normal: {
  524. show: false,
  525. textStyle: { //更改数值样式
  526. color: '#43EDE3'
  527. }
  528. },
  529. },
  530. areaStyle: { //设置区域背景颜色透明度
  531. normal: {
  532. width: 1,
  533. opacity: 0.8,
  534. },
  535. },
  536. }
  537. ]
  538. }
  539. ]
  540. };
  541. tools.loopShowTooltip(myChart, option, {
  542. interval: 2000,
  543. loopSeries: true,
  544. });
  545. myChart.setOption(option)
  546. },
  547. initChart5 () {
  548. let myChart = echarts.init(this.$refs['echart5'])
  549. let option = {
  550. tooltip: {
  551. formatter: data => {
  552. return `${data[0].name}<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[0].color.colorStops[0].color}"></span> ${data[0].seriesName}:${data[0].value}亿 <br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[1].color.colorStops[0].color}"></span> ${data[1].seriesName}:${data[1].value}亿`
  553. },
  554. trigger: 'axis',
  555. // axisPointer: {
  556. // type: 'cross',
  557. // },
  558. },
  559. grid: {
  560. top: '16%',
  561. right:'3%',
  562. left: '3%',
  563. bottom: '25%',
  564. },
  565. legend: {
  566. data: ["计划投资", "实际投资"],
  567. x:'center',
  568. y:'10px',
  569. textStyle: {
  570. color: 'rgba(250,250,250,0.6)',
  571. },
  572. },
  573. xAxis: {
  574. data: title.map(item=>item.name),
  575. axisLine: {
  576. show: true, //隐藏X轴轴线
  577. lineStyle: {
  578. color: '#005094',
  579. width: 1,
  580. },
  581. },
  582. axisTick: {
  583. show: false, //隐藏X轴刻度
  584. },
  585. axisLabel: {
  586. show: true,
  587. rotate: 40,
  588. textStyle: {
  589. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  590. },
  591. },
  592. },
  593. yAxis: [
  594. {
  595. type: 'value',
  596. name: '亿元',
  597. nameTextStyle: {
  598. color: 'rgba(255,255,255,0.6)',
  599. },
  600. splitLine: {
  601. show: true,
  602. lineStyle: {
  603. color: '#68b4dd66',
  604. type: 'dashed',
  605. },
  606. },
  607. axisLine: {
  608. show: true,
  609. lineStyle: {
  610. color: '#3D7495',
  611. },
  612. },
  613. axisLabel: {
  614. show: true,
  615. textStyle: {
  616. color: 'rgba(250,250,250,0.6)',
  617. },
  618. },
  619. },
  620. ],
  621. series: [
  622. {
  623. name: '计划投资',
  624. type: 'bar',
  625. barWidth: 10,
  626. itemStyle: {
  627. normal: {
  628. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  629. {
  630. offset: 0,
  631. color: '#69c0ff',
  632. },
  633. {
  634. offset: 1,
  635. color: '#082550',
  636. },
  637. ]),
  638. },
  639. },
  640. data: echartL1[0],
  641. },
  642. {
  643. name: '实际投资',
  644. type: 'bar',
  645. barWidth: 10,
  646. itemStyle: {
  647. normal: {
  648. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  649. {
  650. offset: 0,
  651. color: '#957DFF',
  652. },
  653. {
  654. offset: 1,
  655. color: '#082550',
  656. },
  657. ]),
  658. },
  659. },
  660. data: echartL1[1],
  661. },
  662. ],
  663. }
  664. myChart.setOption(option)
  665. tools.loopShowTooltip(myChart, option, {
  666. nterval: 2000,
  667. loopSeries: true,
  668. })
  669. },
  670. },
  671. })