investHome5.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  1. let app = new Vue({
  2. el: '#app',
  3. data () {
  4. return {
  5. timeOut1:'',
  6. timeOut2:'',
  7. timeOut3:'',
  8. titleList: [
  9. { name: '初步设计', type: 1, number: '106' },
  10. { name: '', type: 1, number: '' },
  11. { name: '详细设计', type: 1, number: '103' },
  12. { name: '', type: 1, number: '' },
  13. { name: '施工', type: 1, number: '62' },
  14. { name: '', type: 1, number: '' },
  15. { name: '完工', type: 1, number: '35' },
  16. { name: '', type: 1, number: '' },
  17. { name: '验收', type: 2, number: '42' },
  18. { name: '', type: 1, number: '' },
  19. { name: '结算', type: 1, number: '33' }
  20. ],
  21. centerLeftList: [
  22. { name: '正偏差', value: '160', value2: '500' },
  23. { name: '容差内', value: '28', value2: '264' },
  24. { name: '负偏差', value: '103', value2: '182' }
  25. ],
  26. time: '',
  27. timer: '',
  28. }
  29. },
  30. created () {
  31. this.time = formatDate()
  32. this.timer = setInterval(() => {
  33. this.time = formatDate()
  34. })
  35. },
  36. beforeDestroy () {
  37. if (this.timer) {
  38. clearInterval(this.timer);
  39. clearInterval(this.timeOut1);
  40. clearInterval(this.timeOut2);
  41. clearInterval(this.timeOut3);
  42. }
  43. },
  44. mounted () {
  45. setTimeout(() => {
  46. this.initChart1()
  47. this.initChart2()
  48. this.initChart3()
  49. this.initChart4()
  50. this.initChart5()
  51. })
  52. },
  53. methods: {
  54. initChart1 () {
  55. let myChart = echarts.init(this.$refs['echart1'])
  56. let option = {
  57. tooltip: {
  58. formatter: data => {
  59. 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}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[2].color.colorStops[0].color}"></span> ${data[2].seriesName}:${data[2].value}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[3].color.colorStops[0].color}"></span> ${data[3].seriesName}:${data[3].value}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[4].color.colorStops[0].color}"></span> ${data[4].seriesName}:${data[4].value}亿`
  60. },
  61. trigger: 'axis',
  62. axisPointer: {
  63. type: 'cross',
  64. },
  65. },
  66. dataZoom: [
  67. {
  68. // start: 9,//默认为@
  69. // end: 100,//黑认认为1@0
  70. type: "slider",
  71. show: false,
  72. // xAxisIndex: [0]
  73. handlesize: 0,//滑动条的 左右2个滑动条的大小
  74. startValue: 8,// 初始显示值
  75. endValue: 0,// 结束显示值
  76. height: 10,//组件高度
  77. left: "5%",
  78. right: "4%",//右边的距离
  79. bottom: "25%",//底边的距离
  80. borderColor: "#939",
  81. fillerColor: "#269cdb",
  82. borderRadius: 5,
  83. backgroundColor: "#33384b",//两边未选中的滑动条区域的额色
  84. showDataShadow: false,//是否显示数据阴影
  85. showDetail: false,//即拖拽时候是否显示详细数值信息
  86. truerealtime: true,//是否实时更新
  87. filterMode: "filter"
  88. }, {
  89. type: 'inside',
  90. show: true,
  91. start: 1,
  92. end: 100
  93. }
  94. ],
  95. grid: {
  96. top: '16%',
  97. right: '3%',
  98. left: '5%',
  99. bottom: '15%',
  100. },
  101. legend: {
  102. data: ["预算额", "已签合同额", '产值认定额', '结算额', '结算额'],
  103. x: 'center',
  104. y: '20px',
  105. textStyle: {
  106. color: 'rgba(250,250,250,0.6)',
  107. },
  108. },
  109. xAxis: {
  110. data: echart1.map(item => item.name),
  111. axisLine: {
  112. show: true, //隐藏X轴轴线
  113. lineStyle: {
  114. color: '#005094',
  115. width: 1,
  116. },
  117. },
  118. axisTick: {
  119. show: false, //隐藏X轴刻度
  120. },
  121. axisLabel: {
  122. show: true,
  123. rotate: 40,
  124. textStyle: {
  125. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  126. },
  127. },
  128. },
  129. yAxis: [
  130. {
  131. type: 'value',
  132. name: '亿元',
  133. nameTextStyle: {
  134. color: 'rgba(255,255,255,0.6)',
  135. },
  136. splitLine: {
  137. show: true,
  138. lineStyle: {
  139. color: '#68b4dd66',
  140. type: 'dashed',
  141. },
  142. },
  143. axisLine: {
  144. show: true,
  145. lineStyle: {
  146. color: '#3D7495',
  147. },
  148. },
  149. axisLabel: {
  150. show: true,
  151. textStyle: {
  152. color: 'rgba(250,250,250,0.6)',
  153. },
  154. },
  155. },
  156. ],
  157. series: [
  158. {
  159. name: '预算额',
  160. type: 'bar',
  161. barWidth: 10,
  162. itemStyle: {
  163. normal: {
  164. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  165. {
  166. offset: 0,
  167. color: '#71D5FF',
  168. },
  169. {
  170. offset: 1,
  171. color: '#082550',
  172. },
  173. ]),
  174. },
  175. },
  176. data: echart1.map(item => item.value),
  177. },
  178. {
  179. name: '已签合同额',
  180. type: 'bar',
  181. barWidth: 10,
  182. itemStyle: {
  183. normal: {
  184. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  185. {
  186. offset: 0,
  187. color: '#4D6FF6',
  188. },
  189. {
  190. offset: 1,
  191. color: '#082550',
  192. },
  193. ]),
  194. },
  195. },
  196. data: echart1.map(item => item.value2),
  197. },
  198. {
  199. name: '产值认定额',
  200. type: 'bar',
  201. barWidth: 10,
  202. itemStyle: {
  203. normal: {
  204. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  205. {
  206. offset: 0,
  207. color: '#877CFC',
  208. },
  209. {
  210. offset: 1,
  211. color: '#082550',
  212. },
  213. ]),
  214. },
  215. },
  216. data: echart1.map(item => item.value),
  217. },
  218. {
  219. name: '结算额',
  220. type: 'bar',
  221. barWidth: 10,
  222. itemStyle: {
  223. normal: {
  224. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  225. {
  226. offset: 0,
  227. color: '#52BF80',
  228. },
  229. {
  230. offset: 1,
  231. color: '#082550',
  232. },
  233. ]),
  234. },
  235. },
  236. data: echart1.map(item => item.value2),
  237. },
  238. {
  239. name: '付款额',
  240. type: 'bar',
  241. barWidth: 10,
  242. itemStyle: {
  243. normal: {
  244. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  245. {
  246. offset: 0,
  247. color: '#CADD62',
  248. },
  249. {
  250. offset: 1,
  251. color: '#082550',
  252. },
  253. ]),
  254. },
  255. },
  256. data: echart1.map(item => item.value),
  257. },
  258. ],
  259. }
  260. myChart.setOption(option)
  261. tools.loopShowTooltip(myChart, option, {
  262. interval: 2000,
  263. loopSeries: true,
  264. })
  265. let arr = echart1.map(item => item.value2)
  266. this.timeOut1 = setInterval(function () {
  267. let startValue = myChart.getModel().option.dataZoom[0].startValue;
  268. let endValue = myChart.getModel().option.dataZoom[0].endValue;
  269. let start = myChart.getModel().option.xAxis[0].data[startValue];//起始X轴
  270. let end = myChart.getModel().option.xAxis[0].data[endValue];//结束X轴
  271. // 每次向后滚动一个,最后一个从头开始。
  272. // console.log(option.dataZoom[0].endValue);
  273. if (option.dataZoom[0].endValue >= 9) {
  274. option.dataZoom[0].endValue = 8
  275. option.dataZoom[0].startValue = 0
  276. } else {
  277. option.dataZoom[0].endValue = option.dataZoom[0].endValue + 9
  278. option.dataZoom[0].startValue = option.dataZoom[0].startValue + 9
  279. }
  280. // myChart.dispatchAction({
  281. // type: 'showTip',
  282. // seriesIndex: 0,
  283. // dataIndex: startValue +1,
  284. // });
  285. myChart.setOption(option);
  286. }, 18000);
  287. },
  288. initChart2 () {
  289. const itemStyle = {
  290. // opacity: 0.8,
  291. shadowBlur: 10,
  292. shadowOffsetX: 0,
  293. shadowOffsetY: 0,
  294. shadowColor: 'rgba(0,0,0,0.3)'
  295. };
  296. let myChart = echarts.init(this.$refs['echart2'])
  297. let option = {
  298. color: ['#80F1BE', '#fec42c', '#dd4444'],
  299. title: {
  300. textStyle: {
  301. color: '#69C0FF',
  302. fontSize: 16,
  303. fontWeight: 500
  304. },
  305. top: '10',
  306. left: '10'
  307. },
  308. legend: {
  309. top: 10,
  310. data: ['正偏差', '容差', '负偏差'],
  311. textStyle: {
  312. fontSize: 12,
  313. color: '#fff'
  314. }
  315. },
  316. textStyle: {
  317. color: '#fff',
  318. },
  319. tooltip: {
  320. show: true,
  321. trigger: "axis",
  322. // formatter: function (params) {
  323. // 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] + '亿元';
  324. // return tip
  325. // },
  326. formatter: data => {
  327. return `${data[0].value[0]}<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[0].color}"></span> ${data[0].seriesName}:${data[0].data[1]}亿<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[1].color}"></span> ${data[1].seriesName}:${data[1].data[1]}亿<br /><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[2].color}"></span> ${data[2].seriesName}:${data[2].data[1]}亿`
  328. },
  329. axisPointer: {
  330. lineStyle: {
  331. type: 'dashed',
  332. width: 2,
  333. color: 'rgba(255,255,255,0.6)'
  334. },
  335. animation: true
  336. }
  337. },
  338. grid: {
  339. top: '15%',
  340. right: '5%',
  341. left: '6%',
  342. bottom: '15%',
  343. },
  344. yAxis: {
  345. name: '亿元',
  346. splitLine: {
  347. show: true,
  348. lineStyle: {
  349. color: '#68b4dd66',
  350. type: 'dashed',
  351. },
  352. },
  353. axisLine: {
  354. show: false
  355. },
  356. axisLabel: {
  357. show: true,
  358. formatter: '{value}',
  359. textStyle: {
  360. color: 'rgba(250,250,250,0.6)',
  361. },
  362. },
  363. nameTextStyle: {
  364. color: '#fff',
  365. fontSize: 10,
  366. },
  367. },
  368. xAxis: {
  369. data: echart2[0].map(item => item[0]),
  370. axisLine: {
  371. show: true, //隐藏X轴轴线
  372. lineStyle: {
  373. color: '#005094',
  374. width: 1,
  375. },
  376. },
  377. splitLine: {
  378. show: true,
  379. lineStyle: {
  380. color: '#68b4dd66',
  381. type: 'dashed',
  382. },
  383. },
  384. axisTick: {
  385. show: false, //隐藏X轴刻度
  386. },
  387. axisLabel: {
  388. show: true,
  389. rotate: 40,
  390. padding: [30, -15, 0, 0],
  391. textStyle: {
  392. color: '#fff', //X轴文字颜色
  393. fontSize: 12,
  394. },
  395. },
  396. },
  397. series: [
  398. {
  399. name: '正偏差',
  400. type: 'scatter',
  401. itemStyle: itemStyle,
  402. data: echart2[0],
  403. symbolSize: function (data) {
  404. return Math.sqrt(data[1]) * 4;
  405. },
  406. },
  407. {
  408. name: '容差',
  409. type: 'scatter',
  410. itemStyle: itemStyle,
  411. data: echart2[1],
  412. symbolSize: function (data) {
  413. return Math.sqrt(data[1])* 4;
  414. },
  415. },
  416. {
  417. name: '负偏差',
  418. type: 'scatter',
  419. itemStyle: itemStyle,
  420. data: echart2[2],
  421. symbolSize: function (data) {
  422. return Math.sqrt(data[1])* 4;
  423. },
  424. }
  425. ]
  426. }
  427. myChart.setOption(option)
  428. tools.loopShowTooltip(myChart, option, {
  429. nterval: 2000,
  430. loopSeries: true,
  431. })
  432. },
  433. // let myChart = echarts.init(this.$refs['echart3'])
  434. // let option = {
  435. // tooltip: {
  436. // formatter: data => {
  437. // 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}亿`
  438. // },
  439. // trigger: 'axis',
  440. // // axisPointer: {
  441. // // type: 'cross',
  442. // // },
  443. // },
  444. // grid: {
  445. // top: '16%',
  446. // right: '3%',
  447. // left: '10%',
  448. // bottom: '25%',
  449. // },
  450. // legend: {
  451. // data: ["高风险", "中风险", '低风险'],
  452. // x: 'center',
  453. // y: '10px',
  454. // textStyle: {
  455. // color: 'rgba(250,250,250,0.6)',
  456. // },
  457. // },
  458. // xAxis: {
  459. // data: title.map(item => item.name),
  460. // axisLine: {
  461. // show: true, //隐藏X轴轴线
  462. // lineStyle: {
  463. // color: '#005094',
  464. // width: 1,
  465. // },
  466. // },
  467. // axisTick: {
  468. // show: false, //隐藏X轴刻度
  469. // },
  470. // axisLabel: {
  471. // show: true,
  472. // rotate: 40,
  473. // textStyle: {
  474. // color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  475. // },
  476. // },
  477. // },
  478. // yAxis: [
  479. // {
  480. // type: 'value',
  481. // name: '亿元',
  482. // nameTextStyle: {
  483. // color: 'rgba(255,255,255,0.6)',
  484. // },
  485. // splitLine: {
  486. // show: true,
  487. // lineStyle: {
  488. // color: '#68b4dd66',
  489. // type: 'dashed',
  490. // },
  491. // },
  492. // axisLine: {
  493. // show: true,
  494. // lineStyle: {
  495. // color: '#3D7495',
  496. // },
  497. // },
  498. // axisLabel: {
  499. // show: true,
  500. // textStyle: {
  501. // color: 'rgba(250,250,250,0.6)',
  502. // },
  503. // },
  504. // },
  505. // ],
  506. // series: [
  507. // {
  508. // name: '高风险',
  509. // type: 'bar',
  510. // barWidth: 5,
  511. // itemStyle: {
  512. // normal: {
  513. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  514. // {
  515. // offset: 0,
  516. // color: '#69c0ff',
  517. // },
  518. // {
  519. // offset: 1,
  520. // color: '#082550',
  521. // },
  522. // ]),
  523. // },
  524. // },
  525. // data: echart3.map(item => item.value),
  526. // },
  527. // {
  528. // name: '中风险',
  529. // type: 'bar',
  530. // barWidth: 5,
  531. // itemStyle: {
  532. // normal: {
  533. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  534. // {
  535. // offset: 0,
  536. // color: '#957DFF',
  537. // },
  538. // {
  539. // offset: 1,
  540. // color: '#082550',
  541. // },
  542. // ]),
  543. // },
  544. // },
  545. // data: echart3.map(item => item.value2),
  546. // },
  547. // {
  548. // name: '低风险',
  549. // type: 'bar',
  550. // barWidth: 5,
  551. // itemStyle: {
  552. // normal: {
  553. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  554. // {
  555. // offset: 0,
  556. // color: '#957DFF',
  557. // },
  558. // {
  559. // offset: 1,
  560. // color: '#082550',
  561. // },
  562. // ]),
  563. // },
  564. // },
  565. // data: echart3.map(item => item.value3),
  566. // },
  567. // ],
  568. // }
  569. // myChart.setOption(option)
  570. // tools.loopShowTooltip(myChart, option, {
  571. // nterval: 2000,
  572. // loopSeries: true,
  573. // })
  574. // },
  575. initChart3 () {
  576. let myChart = echarts.init(this.$refs['echart3'])
  577. let option = {
  578. tooltip: {
  579. formatter: data => {
  580. 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}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[2].color.colorStops[0].color}"></span> ${data[2].seriesName}:${data[2].value}亿`
  581. },
  582. trigger: 'axis',
  583. axisPointer: {
  584. type: 'cross',
  585. },
  586. },
  587. dataZoom: [
  588. {
  589. // start: 9,//默认为@
  590. // end: 100,//黑认认为1@0
  591. type: "slider",
  592. show: false,
  593. // xAxisIndex: [0]
  594. handlesize: 0,//滑动条的 左右2个滑动条的大小
  595. startValue: 5,// 初始显示值
  596. endValue: 0,// 结束显示值
  597. height: 10,//组件高度
  598. left: "5%",
  599. right: "4%",//右边的距离
  600. bottom: "25%",//底边的距离
  601. borderColor: "#939",
  602. fillerColor: "#269cdb",
  603. borderRadius: 5,
  604. backgroundColor: "#33384b",//两边未选中的滑动条区域的额色
  605. showDataShadow: false,//是否显示数据阴影
  606. showDetail: false,//即拖拽时候是否显示详细数值信息
  607. truerealtime: true,//是否实时更新
  608. filterMode: "filter"
  609. }, {
  610. type: 'inside',
  611. show: true,
  612. start: 1,
  613. end: 100
  614. }
  615. ],
  616. grid: {
  617. top: '20%',
  618. right: '3%',
  619. left: '10%',
  620. bottom: '28%',
  621. },
  622. legend: {
  623. data: ["高风险", "中风险", '低风险'],
  624. x: 'center',
  625. y: '0px',
  626. textStyle: {
  627. color: 'rgba(250,250,250,0.6)',
  628. },
  629. },
  630. xAxis: {
  631. data: echart1.map(item => item.name),
  632. axisLine: {
  633. show: true, //隐藏X轴轴线
  634. lineStyle: {
  635. color: '#005094',
  636. width: 1,
  637. },
  638. },
  639. axisTick: {
  640. show: false, //隐藏X轴刻度
  641. },
  642. axisLabel: {
  643. show: true,
  644. rotate: 40,
  645. textStyle: {
  646. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  647. },
  648. },
  649. },
  650. yAxis: [
  651. {
  652. type: 'value',
  653. name: '亿元',
  654. nameTextStyle: {
  655. color: 'rgba(255,255,255,0.6)',
  656. },
  657. splitLine: {
  658. show: true,
  659. lineStyle: {
  660. color: '#68b4dd66',
  661. type: 'dashed',
  662. },
  663. },
  664. axisLine: {
  665. show: true,
  666. lineStyle: {
  667. color: '#3D7495',
  668. },
  669. },
  670. axisLabel: {
  671. show: true,
  672. textStyle: {
  673. color: 'rgba(250,250,250,0.6)',
  674. },
  675. },
  676. },
  677. ],
  678. series: [
  679. {
  680. name: '高风险',
  681. type: 'bar',
  682. barWidth: 10,
  683. itemStyle: {
  684. normal: {
  685. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  686. {
  687. offset: 0,
  688. color: '#71D5FF',
  689. },
  690. {
  691. offset: 1,
  692. color: '#082550',
  693. },
  694. ]),
  695. },
  696. },
  697. data: echart3.map(item => item.value),
  698. },
  699. {
  700. name: '中风险',
  701. type: 'bar',
  702. barWidth: 10,
  703. itemStyle: {
  704. normal: {
  705. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  706. {
  707. offset: 0,
  708. color: '#4D6FF6',
  709. },
  710. {
  711. offset: 1,
  712. color: '#082550',
  713. },
  714. ]),
  715. },
  716. },
  717. data: echart3.map(item => item.value2),
  718. },
  719. {
  720. name: '低风险',
  721. type: 'bar',
  722. barWidth: 10,
  723. itemStyle: {
  724. normal: {
  725. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  726. {
  727. offset: 0,
  728. color: '#877CFC',
  729. },
  730. {
  731. offset: 1,
  732. color: '#082550',
  733. },
  734. ]),
  735. },
  736. },
  737. data: echart3.map(item => item.value3),
  738. },
  739. ],
  740. }
  741. myChart.setOption(option)
  742. tools.loopShowTooltip(myChart, option, {
  743. interval: 2000,
  744. loopSeries: true,
  745. })
  746. let arr = echart1.map(item => item.value2)
  747. this.timeOut2 = setInterval(function () {
  748. let startValue = myChart.getModel().option.dataZoom[0].startValue;
  749. let endValue = myChart.getModel().option.dataZoom[0].endValue;
  750. let start = myChart.getModel().option.xAxis[0].data[startValue];//起始X轴
  751. let end = myChart.getModel().option.xAxis[0].data[endValue];//结束X轴
  752. // 每次向后滚动一个,最后一个从头开始。
  753. // console.log(option.dataZoom[0].endValue);
  754. if (option.dataZoom[0].endValue >= 12) {
  755. option.dataZoom[0].endValue = 5
  756. option.dataZoom[0].startValue = 0
  757. } else {
  758. option.dataZoom[0].endValue = option.dataZoom[0].endValue + 6
  759. option.dataZoom[0].startValue = option.dataZoom[0].startValue + 6
  760. }
  761. // myChart.dispatchAction({
  762. // type: 'showTip',
  763. // seriesIndex: 0,
  764. // dataIndex: startValue +1,
  765. // });
  766. myChart.setOption(option);
  767. }, 12000);
  768. },
  769. initChart4 () {
  770. let myChart = echarts.init(this.$refs['echart4'])
  771. option = {
  772. title: {
  773. text: ''
  774. },
  775. legend: {
  776. data: ['类型1', '类型2', '类型3', '类型4', '类型5'],
  777. textStyle: {
  778. color: '#9DB9EB',
  779. },
  780. },
  781. splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
  782. show: true,
  783. areaStyle: { // 分隔区域的样式设置。
  784. color: ['yellow'],
  785. // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
  786. }
  787. },
  788. radar: {
  789. // shape: 'circle',
  790. center: ['50%', '60%'],
  791. radius: 40,
  792. indicator: [
  793. { name: '类型1', max: 100000 },
  794. { name: '类型2', max: 100000 },
  795. { name: '类型3', max: 100000 },
  796. { name: '类型4', max: 100000 },
  797. { name: '类型5', max: 100000 },
  798. ],
  799. axisLine: { // 设置雷达图中间射线的颜色
  800. lineStyle: {
  801. color: '#c0c0c0',
  802. },
  803. },
  804. splitLine: { //网格颜色设置
  805. show: true,
  806. lineStyle: {
  807. width: 1,
  808. color: '#1e83e4',
  809. },
  810. },
  811. splitArea: { //设置图表颜色,show的值为true
  812. show: false,
  813. areaStyle: {
  814. // color:"#c1ddf8", //一般设置方式
  815. //设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
  816. //a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
  817. //b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
  818. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  819. { offset: 0, color: '#c1ddf8' }, // 0% 处的颜色
  820. { offset: 1, color: '#1e83e4' }// 100% 处的颜色
  821. ], false)
  822. }
  823. }
  824. },
  825. series: [
  826. {
  827. name: '',
  828. type: 'radar',
  829. symbol: 'circle', // 单个数值点的样式,还可以取值'rect','angle'等
  830. symbolSize: 0, // 数值点的大小
  831. data: [
  832. {
  833. value: echart4[0],
  834. name: '类型1',
  835. itemStyle: { //该数值区域样式设置
  836. normal: {
  837. color: '#2CC6FF', //背景颜色,还需设置areaStyle
  838. lineStyle: {
  839. color: '#2CC6FF', //边框颜色
  840. },
  841. },
  842. },
  843. label: { //显示value中具体的数值
  844. normal: {
  845. show: false,
  846. textStyle: { //更改数值样式
  847. color: '#43EDE3'
  848. }
  849. },
  850. },
  851. areaStyle: { //设置区域背景颜色透明度
  852. normal: {
  853. width: 1,
  854. opacity: 0.8,
  855. },
  856. },
  857. },
  858. {
  859. value: echart4[1],
  860. name: '类型2',
  861. itemStyle: { //该数值区域样式设置
  862. normal: {
  863. color: '#D87AFF', //背景颜色,还需设置areaStyle
  864. lineStyle: {
  865. color: '#2CC6FF', //边框颜色
  866. },
  867. },
  868. },
  869. label: { //显示value中具体的数值
  870. normal: {
  871. show: false,
  872. textStyle: { //更改数值样式
  873. color: '#43EDE3'
  874. }
  875. },
  876. },
  877. areaStyle: { //设置区域背景颜色透明度
  878. normal: {
  879. width: 1,
  880. opacity: 0.8,
  881. },
  882. },
  883. }
  884. ]
  885. }
  886. ]
  887. };
  888. tools.loopShowTooltip(myChart, option, {
  889. interval: 2000,
  890. loopSeries: true,
  891. });
  892. myChart.setOption(option)
  893. },
  894. // initChart5 () {
  895. // let myChart = echarts.init(this.$refs['echart5'])
  896. // let option = {
  897. // tooltip: {
  898. // formatter: data => {
  899. // 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}亿`
  900. // },
  901. // trigger: 'axis',
  902. // // axisPointer: {
  903. // // type: 'cross',
  904. // // },
  905. // },
  906. // grid: {
  907. // top: '16%',
  908. // right: '3%',
  909. // left: '3%',
  910. // bottom: '25%',
  911. // },
  912. // legend: {
  913. // data: ["预算额", "合同额", "结算额", "支付额"],
  914. // x: 'center',
  915. // y: '10px',
  916. // textStyle: {
  917. // color: 'rgba(250,250,250,0.6)',
  918. // },
  919. // },
  920. // xAxis: {
  921. // data: title.map(item => item.name),
  922. // axisLine: {
  923. // show: true, //隐藏X轴轴线
  924. // lineStyle: {
  925. // color: '#005094',
  926. // width: 1,
  927. // },
  928. // },
  929. // axisTick: {
  930. // show: false, //隐藏X轴刻度
  931. // },
  932. // axisLabel: {
  933. // show: true,
  934. // rotate: 40,
  935. // textStyle: {
  936. // color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  937. // },
  938. // },
  939. // },
  940. // yAxis: [
  941. // {
  942. // type: 'value',
  943. // name: '亿元',
  944. // nameTextStyle: {
  945. // color: 'rgba(255,255,255,0.6)',
  946. // },
  947. // splitLine: {
  948. // show: true,
  949. // lineStyle: {
  950. // color: '#68b4dd66',
  951. // type: 'dashed',
  952. // },
  953. // },
  954. // axisLine: {
  955. // show: true,
  956. // lineStyle: {
  957. // color: '#3D7495',
  958. // },
  959. // },
  960. // axisLabel: {
  961. // show: true,
  962. // textStyle: {
  963. // color: 'rgba(250,250,250,0.6)',
  964. // },
  965. // },
  966. // },
  967. // ],
  968. // series: [
  969. // {
  970. // name: '预算额',
  971. // type: 'bar',
  972. // barWidth: 10,
  973. // itemStyle: {
  974. // normal: {
  975. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  976. // {
  977. // offset: 0,
  978. // color: '#69c0ff',
  979. // },
  980. // {
  981. // offset: 1,
  982. // color: '#082550',
  983. // },
  984. // ]),
  985. // },
  986. // },
  987. // data: title.map(item => item.value),
  988. // },
  989. // {
  990. // name: '合同额',
  991. // type: 'bar',
  992. // barWidth: 10,
  993. // itemStyle: {
  994. // normal: {
  995. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  996. // {
  997. // offset: 0,
  998. // color: '#957DFF',
  999. // },
  1000. // {
  1001. // offset: 1,
  1002. // color: '#082550',
  1003. // },
  1004. // ]),
  1005. // },
  1006. // },
  1007. // data: title.map(item => item.value2),
  1008. // },
  1009. // {
  1010. // name: '结算额',
  1011. // type: 'bar',
  1012. // barWidth: 10,
  1013. // itemStyle: {
  1014. // normal: {
  1015. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1016. // {
  1017. // offset: 0,
  1018. // color: '#957DFF',
  1019. // },
  1020. // {
  1021. // offset: 1,
  1022. // color: '#082550',
  1023. // },
  1024. // ]),
  1025. // },
  1026. // },
  1027. // data: title.map(item => item.value3),
  1028. // },
  1029. // {
  1030. // name: '支付额',
  1031. // type: 'bar',
  1032. // barWidth: 10,
  1033. // itemStyle: {
  1034. // normal: {
  1035. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1036. // {
  1037. // offset: 0,
  1038. // color: '#957DFF',
  1039. // },
  1040. // {
  1041. // offset: 1,
  1042. // color: '#082550',
  1043. // },
  1044. // ]),
  1045. // },
  1046. // },
  1047. // data: title.map(item => item.value4),
  1048. // },
  1049. // ],
  1050. // }
  1051. // myChart.setOption(option)
  1052. // tools.loopShowTooltip(myChart, option, {
  1053. // nterval: 2000,
  1054. // loopSeries: true,
  1055. // })
  1056. // },
  1057. initChart5 () {
  1058. let myChart = echarts.init(this.$refs['echart5'])
  1059. let option = {
  1060. tooltip: {
  1061. formatter: data => {
  1062. 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}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[2].color.colorStops[0].color}"></span> ${data[2].seriesName}:${data[2].value}亿<br/><span style="display:inline-block;border-radius:50%; width:7px;height:7px;background-color:${data[3].color.colorStops[0].color}"></span> ${data[3].seriesName}:${data[3].value}亿`
  1063. },
  1064. trigger: 'axis',
  1065. axisPointer: {
  1066. type: 'cross',
  1067. },
  1068. },
  1069. dataZoom: [
  1070. {
  1071. // start: 9,//默认为@
  1072. // end: 100,//黑认认为1@0
  1073. type: "slider",
  1074. show: false,
  1075. // xAxisIndex: [0]
  1076. handlesize: 0,//滑动条的 左右2个滑动条的大小
  1077. startValue: 8,// 初始显示值
  1078. endValue: 0,// 结束显示值
  1079. height: 10,//组件高度
  1080. left: "5%",
  1081. right: "4%",//右边的距离
  1082. bottom: "25%",//底边的距离
  1083. borderColor: "#939",
  1084. fillerColor: "#269cdb",
  1085. borderRadius: 5,
  1086. backgroundColor: "#33384b",//两边未选中的滑动条区域的额色
  1087. showDataShadow: false,//是否显示数据阴影
  1088. showDetail: false,//即拖拽时候是否显示详细数值信息
  1089. truerealtime: true,//是否实时更新
  1090. filterMode: "filter"
  1091. }, {
  1092. type: 'inside',
  1093. show: true,
  1094. start: 1,
  1095. end: 100
  1096. }
  1097. ],
  1098. grid: {
  1099. top: '20%',
  1100. right: '3%',
  1101. left: '5%',
  1102. bottom: '25%',
  1103. },
  1104. legend: {
  1105. data: ["预算额", "合同额", "结算额", "支付额"],
  1106. x: 'center',
  1107. y: '0px',
  1108. textStyle: {
  1109. color: 'rgba(250,250,250,0.6)',
  1110. },
  1111. },
  1112. xAxis: {
  1113. data: echart1.map(item => item.name),
  1114. axisLine: {
  1115. show: true, //隐藏X轴轴线
  1116. lineStyle: {
  1117. color: '#005094',
  1118. width: 1,
  1119. },
  1120. },
  1121. axisTick: {
  1122. show: false, //隐藏X轴刻度
  1123. },
  1124. axisLabel: {
  1125. show: true,
  1126. rotate: 40,
  1127. textStyle: {
  1128. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  1129. },
  1130. },
  1131. },
  1132. yAxis: [
  1133. {
  1134. type: 'value',
  1135. name: '亿元',
  1136. nameTextStyle: {
  1137. color: 'rgba(255,255,255,0.6)',
  1138. },
  1139. splitLine: {
  1140. show: true,
  1141. lineStyle: {
  1142. color: '#68b4dd66',
  1143. type: 'dashed',
  1144. },
  1145. },
  1146. axisLine: {
  1147. show: true,
  1148. lineStyle: {
  1149. color: '#3D7495',
  1150. },
  1151. },
  1152. axisLabel: {
  1153. show: true,
  1154. textStyle: {
  1155. color: 'rgba(250,250,250,0.6)',
  1156. },
  1157. },
  1158. },
  1159. ],
  1160. series: [
  1161. {
  1162. name: '预算额',
  1163. type: 'bar',
  1164. barWidth: 10,
  1165. itemStyle: {
  1166. normal: {
  1167. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1168. {
  1169. offset: 0,
  1170. color: '#71D5FF',
  1171. },
  1172. {
  1173. offset: 1,
  1174. color: '#082550',
  1175. },
  1176. ]),
  1177. },
  1178. },
  1179. data: echart5.map(item => item.value),
  1180. },
  1181. {
  1182. name: '合同额',
  1183. type: 'bar',
  1184. barWidth: 10,
  1185. itemStyle: {
  1186. normal: {
  1187. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1188. {
  1189. offset: 0,
  1190. color: '#4D6FF6',
  1191. },
  1192. {
  1193. offset: 1,
  1194. color: '#082550',
  1195. },
  1196. ]),
  1197. },
  1198. },
  1199. data: echart5.map(item => item.value2),
  1200. },
  1201. {
  1202. name: '结算额',
  1203. type: 'bar',
  1204. barWidth: 10,
  1205. itemStyle: {
  1206. normal: {
  1207. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1208. {
  1209. offset: 0,
  1210. color: '#877CFC',
  1211. },
  1212. {
  1213. offset: 1,
  1214. color: '#082550',
  1215. },
  1216. ]),
  1217. },
  1218. },
  1219. data: echart5.map(item => item.value3),
  1220. },
  1221. {
  1222. name: '支付额',
  1223. type: 'bar',
  1224. barWidth: 10,
  1225. itemStyle: {
  1226. normal: {
  1227. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1228. {
  1229. offset: 0,
  1230. color: '#52BF80',
  1231. },
  1232. {
  1233. offset: 1,
  1234. color: '#082550',
  1235. },
  1236. ]),
  1237. },
  1238. },
  1239. data: echart5.map(item => item.value4),
  1240. },
  1241. ],
  1242. }
  1243. myChart.setOption(option)
  1244. tools.loopShowTooltip(myChart, option, {
  1245. interval: 2000,
  1246. loopSeries: true,
  1247. })
  1248. let arr = echart1.map(item => item.value2)
  1249. this.timeOut3 = setInterval(function () {
  1250. let startValue = myChart.getModel().option.dataZoom[0].startValue;
  1251. let endValue = myChart.getModel().option.dataZoom[0].endValue;
  1252. let start = myChart.getModel().option.xAxis[0].data[startValue];//起始X轴
  1253. let end = myChart.getModel().option.xAxis[0].data[endValue];//结束X轴
  1254. // 每次向后滚动一个,最后一个从头开始。
  1255. // console.log(option.dataZoom[0].endValue);
  1256. if (option.dataZoom[0].endValue >= 9) {
  1257. option.dataZoom[0].endValue = 8
  1258. option.dataZoom[0].startValue = 0
  1259. } else {
  1260. option.dataZoom[0].endValue = option.dataZoom[0].endValue + 9
  1261. option.dataZoom[0].startValue = option.dataZoom[0].startValue + 9
  1262. }
  1263. // myChart.dispatchAction({
  1264. // type: 'showTip',
  1265. // seriesIndex: 0,
  1266. // dataIndex: startValue +1,
  1267. // });
  1268. myChart.setOption(option);
  1269. }, 18000);
  1270. },
  1271. },
  1272. })