investHome5.js 32 KB

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