investHome5.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  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. console.log(data,'????????')
  328. 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]}亿`
  329. },
  330. axisPointer: {
  331. lineStyle: {
  332. type: 'dashed',
  333. width: 2,
  334. color: 'rgba(255,255,255,0.6)'
  335. },
  336. animation: true
  337. }
  338. },
  339. grid: {
  340. top: '15%',
  341. right: '5%',
  342. left: '6%',
  343. bottom: '15%',
  344. },
  345. yAxis: {
  346. name: '亿元',
  347. splitLine: {
  348. show: true,
  349. lineStyle: {
  350. color: '#68b4dd66',
  351. type: 'dashed',
  352. },
  353. },
  354. axisLine: {
  355. show: false
  356. },
  357. axisLabel: {
  358. show: true,
  359. formatter: '{value}',
  360. textStyle: {
  361. color: 'rgba(250,250,250,0.6)',
  362. },
  363. },
  364. nameTextStyle: {
  365. color: '#fff',
  366. fontSize: 10,
  367. },
  368. },
  369. xAxis: {
  370. data: echart2[0].map(item => item[0]),
  371. axisLine: {
  372. show: true, //隐藏X轴轴线
  373. lineStyle: {
  374. color: '#005094',
  375. width: 1,
  376. },
  377. },
  378. splitLine: {
  379. show: true,
  380. lineStyle: {
  381. color: '#68b4dd66',
  382. type: 'dashed',
  383. },
  384. },
  385. axisTick: {
  386. show: false, //隐藏X轴刻度
  387. },
  388. axisLabel: {
  389. show: true,
  390. rotate: 40,
  391. padding: [30, -15, 0, 0],
  392. textStyle: {
  393. color: '#fff', //X轴文字颜色
  394. fontSize: 12,
  395. },
  396. },
  397. },
  398. series: [
  399. {
  400. name: '正偏差',
  401. type: 'scatter',
  402. itemStyle: itemStyle,
  403. data: echart2[0],
  404. },
  405. {
  406. name: '容差',
  407. type: 'scatter',
  408. itemStyle: itemStyle,
  409. data: echart2[1]
  410. },
  411. {
  412. name: '负偏差',
  413. type: 'scatter',
  414. itemStyle: itemStyle,
  415. data: echart2[2]
  416. }
  417. ]
  418. }
  419. myChart.setOption(option)
  420. tools.loopShowTooltip(myChart, option, {
  421. nterval: 2000,
  422. loopSeries: true,
  423. })
  424. },
  425. // let myChart = echarts.init(this.$refs['echart3'])
  426. // let option = {
  427. // tooltip: {
  428. // formatter: data => {
  429. // 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}亿`
  430. // },
  431. // trigger: 'axis',
  432. // // axisPointer: {
  433. // // type: 'cross',
  434. // // },
  435. // },
  436. // grid: {
  437. // top: '16%',
  438. // right: '3%',
  439. // left: '10%',
  440. // bottom: '25%',
  441. // },
  442. // legend: {
  443. // data: ["高风险", "中风险", '低风险'],
  444. // x: 'center',
  445. // y: '10px',
  446. // textStyle: {
  447. // color: 'rgba(250,250,250,0.6)',
  448. // },
  449. // },
  450. // xAxis: {
  451. // data: title.map(item => item.name),
  452. // axisLine: {
  453. // show: true, //隐藏X轴轴线
  454. // lineStyle: {
  455. // color: '#005094',
  456. // width: 1,
  457. // },
  458. // },
  459. // axisTick: {
  460. // show: false, //隐藏X轴刻度
  461. // },
  462. // axisLabel: {
  463. // show: true,
  464. // rotate: 40,
  465. // textStyle: {
  466. // color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  467. // },
  468. // },
  469. // },
  470. // yAxis: [
  471. // {
  472. // type: 'value',
  473. // name: '亿元',
  474. // nameTextStyle: {
  475. // color: 'rgba(255,255,255,0.6)',
  476. // },
  477. // splitLine: {
  478. // show: true,
  479. // lineStyle: {
  480. // color: '#68b4dd66',
  481. // type: 'dashed',
  482. // },
  483. // },
  484. // axisLine: {
  485. // show: true,
  486. // lineStyle: {
  487. // color: '#3D7495',
  488. // },
  489. // },
  490. // axisLabel: {
  491. // show: true,
  492. // textStyle: {
  493. // color: 'rgba(250,250,250,0.6)',
  494. // },
  495. // },
  496. // },
  497. // ],
  498. // series: [
  499. // {
  500. // name: '高风险',
  501. // type: 'bar',
  502. // barWidth: 5,
  503. // itemStyle: {
  504. // normal: {
  505. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  506. // {
  507. // offset: 0,
  508. // color: '#69c0ff',
  509. // },
  510. // {
  511. // offset: 1,
  512. // color: '#082550',
  513. // },
  514. // ]),
  515. // },
  516. // },
  517. // data: echart3.map(item => item.value),
  518. // },
  519. // {
  520. // name: '中风险',
  521. // type: 'bar',
  522. // barWidth: 5,
  523. // itemStyle: {
  524. // normal: {
  525. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  526. // {
  527. // offset: 0,
  528. // color: '#957DFF',
  529. // },
  530. // {
  531. // offset: 1,
  532. // color: '#082550',
  533. // },
  534. // ]),
  535. // },
  536. // },
  537. // data: echart3.map(item => item.value2),
  538. // },
  539. // {
  540. // name: '低风险',
  541. // type: 'bar',
  542. // barWidth: 5,
  543. // itemStyle: {
  544. // normal: {
  545. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  546. // {
  547. // offset: 0,
  548. // color: '#957DFF',
  549. // },
  550. // {
  551. // offset: 1,
  552. // color: '#082550',
  553. // },
  554. // ]),
  555. // },
  556. // },
  557. // data: echart3.map(item => item.value3),
  558. // },
  559. // ],
  560. // }
  561. // myChart.setOption(option)
  562. // tools.loopShowTooltip(myChart, option, {
  563. // nterval: 2000,
  564. // loopSeries: true,
  565. // })
  566. // },
  567. initChart3 () {
  568. let myChart = echarts.init(this.$refs['echart3'])
  569. let option = {
  570. tooltip: {
  571. formatter: data => {
  572. 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}亿`
  573. },
  574. trigger: 'axis',
  575. axisPointer: {
  576. type: 'cross',
  577. },
  578. },
  579. dataZoom: [
  580. {
  581. // start: 9,//默认为@
  582. // end: 100,//黑认认为1@0
  583. type: "slider",
  584. show: false,
  585. // xAxisIndex: [0]
  586. handlesize: 0,//滑动条的 左右2个滑动条的大小
  587. startValue: 5,// 初始显示值
  588. endValue: 0,// 结束显示值
  589. height: 10,//组件高度
  590. left: "5%",
  591. right: "4%",//右边的距离
  592. bottom: "25%",//底边的距离
  593. borderColor: "#939",
  594. fillerColor: "#269cdb",
  595. borderRadius: 5,
  596. backgroundColor: "#33384b",//两边未选中的滑动条区域的额色
  597. showDataShadow: false,//是否显示数据阴影
  598. showDetail: false,//即拖拽时候是否显示详细数值信息
  599. truerealtime: true,//是否实时更新
  600. filterMode: "filter"
  601. }, {
  602. type: 'inside',
  603. show: true,
  604. start: 1,
  605. end: 100
  606. }
  607. ],
  608. grid: {
  609. top: '20%',
  610. right: '3%',
  611. left: '10%',
  612. bottom: '28%',
  613. },
  614. legend: {
  615. data: ["高风险", "中风险", '低风险'],
  616. x: 'center',
  617. y: '0px',
  618. textStyle: {
  619. color: 'rgba(250,250,250,0.6)',
  620. },
  621. },
  622. xAxis: {
  623. data: echart1.map(item => item.name),
  624. axisLine: {
  625. show: true, //隐藏X轴轴线
  626. lineStyle: {
  627. color: '#005094',
  628. width: 1,
  629. },
  630. },
  631. axisTick: {
  632. show: false, //隐藏X轴刻度
  633. },
  634. axisLabel: {
  635. show: true,
  636. rotate: 40,
  637. textStyle: {
  638. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  639. },
  640. },
  641. },
  642. yAxis: [
  643. {
  644. type: 'value',
  645. name: '亿元',
  646. nameTextStyle: {
  647. color: 'rgba(255,255,255,0.6)',
  648. },
  649. splitLine: {
  650. show: true,
  651. lineStyle: {
  652. color: '#68b4dd66',
  653. type: 'dashed',
  654. },
  655. },
  656. axisLine: {
  657. show: true,
  658. lineStyle: {
  659. color: '#3D7495',
  660. },
  661. },
  662. axisLabel: {
  663. show: true,
  664. textStyle: {
  665. color: 'rgba(250,250,250,0.6)',
  666. },
  667. },
  668. },
  669. ],
  670. series: [
  671. {
  672. name: '高风险',
  673. type: 'bar',
  674. barWidth: 10,
  675. itemStyle: {
  676. normal: {
  677. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  678. {
  679. offset: 0,
  680. color: '#71D5FF',
  681. },
  682. {
  683. offset: 1,
  684. color: '#082550',
  685. },
  686. ]),
  687. },
  688. },
  689. data: echart3.map(item => item.value),
  690. },
  691. {
  692. name: '中风险',
  693. type: 'bar',
  694. barWidth: 10,
  695. itemStyle: {
  696. normal: {
  697. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  698. {
  699. offset: 0,
  700. color: '#4D6FF6',
  701. },
  702. {
  703. offset: 1,
  704. color: '#082550',
  705. },
  706. ]),
  707. },
  708. },
  709. data: echart3.map(item => item.value2),
  710. },
  711. {
  712. name: '低风险',
  713. type: 'bar',
  714. barWidth: 10,
  715. itemStyle: {
  716. normal: {
  717. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  718. {
  719. offset: 0,
  720. color: '#877CFC',
  721. },
  722. {
  723. offset: 1,
  724. color: '#082550',
  725. },
  726. ]),
  727. },
  728. },
  729. data: echart3.map(item => item.value3),
  730. },
  731. ],
  732. }
  733. myChart.setOption(option)
  734. tools.loopShowTooltip(myChart, option, {
  735. interval: 2000,
  736. loopSeries: true,
  737. })
  738. let arr = echart1.map(item => item.value2)
  739. this.timeOut2 = setInterval(function () {
  740. let startValue = myChart.getModel().option.dataZoom[0].startValue;
  741. let endValue = myChart.getModel().option.dataZoom[0].endValue;
  742. let start = myChart.getModel().option.xAxis[0].data[startValue];//起始X轴
  743. let end = myChart.getModel().option.xAxis[0].data[endValue];//结束X轴
  744. // 每次向后滚动一个,最后一个从头开始。
  745. // console.log(option.dataZoom[0].endValue);
  746. if (option.dataZoom[0].endValue >= 12) {
  747. option.dataZoom[0].endValue = 5
  748. option.dataZoom[0].startValue = 0
  749. } else {
  750. option.dataZoom[0].endValue = option.dataZoom[0].endValue + 6
  751. option.dataZoom[0].startValue = option.dataZoom[0].startValue + 6
  752. }
  753. // myChart.dispatchAction({
  754. // type: 'showTip',
  755. // seriesIndex: 0,
  756. // dataIndex: startValue +1,
  757. // });
  758. myChart.setOption(option);
  759. }, 12000);
  760. },
  761. initChart4 () {
  762. let myChart = echarts.init(this.$refs['echart4'])
  763. option = {
  764. title: {
  765. text: ''
  766. },
  767. legend: {
  768. data: ['类型1', '类型2', '类型3', '类型4', '类型5'],
  769. textStyle: {
  770. color: '#9DB9EB',
  771. },
  772. },
  773. splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
  774. show: true,
  775. areaStyle: { // 分隔区域的样式设置。
  776. color: ['yellow'],
  777. // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
  778. }
  779. },
  780. radar: {
  781. // shape: 'circle',
  782. center: ['50%', '60%'],
  783. radius: 40,
  784. indicator: [
  785. { name: '类型1', max: 100000 },
  786. { name: '类型2', max: 100000 },
  787. { name: '类型3', max: 100000 },
  788. { name: '类型4', max: 100000 },
  789. { name: '类型5', max: 100000 },
  790. ],
  791. axisLine: { // 设置雷达图中间射线的颜色
  792. lineStyle: {
  793. color: '#c0c0c0',
  794. },
  795. },
  796. splitLine: { //网格颜色设置
  797. show: true,
  798. lineStyle: {
  799. width: 1,
  800. color: '#1e83e4',
  801. },
  802. },
  803. splitArea: { //设置图表颜色,show的值为true
  804. show: false,
  805. areaStyle: {
  806. // color:"#c1ddf8", //一般设置方式
  807. //设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
  808. //a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
  809. //b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
  810. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  811. { offset: 0, color: '#c1ddf8' }, // 0% 处的颜色
  812. { offset: 1, color: '#1e83e4' }// 100% 处的颜色
  813. ], false)
  814. }
  815. }
  816. },
  817. series: [
  818. {
  819. name: '',
  820. type: 'radar',
  821. symbol: 'circle', // 单个数值点的样式,还可以取值'rect','angle'等
  822. symbolSize: 0, // 数值点的大小
  823. data: [
  824. {
  825. value: echart4[0],
  826. name: '类型1',
  827. itemStyle: { //该数值区域样式设置
  828. normal: {
  829. color: '#2CC6FF', //背景颜色,还需设置areaStyle
  830. lineStyle: {
  831. color: '#2CC6FF', //边框颜色
  832. },
  833. },
  834. },
  835. label: { //显示value中具体的数值
  836. normal: {
  837. show: false,
  838. textStyle: { //更改数值样式
  839. color: '#43EDE3'
  840. }
  841. },
  842. },
  843. areaStyle: { //设置区域背景颜色透明度
  844. normal: {
  845. width: 1,
  846. opacity: 0.8,
  847. },
  848. },
  849. },
  850. {
  851. value: echart4[1],
  852. name: '类型2',
  853. itemStyle: { //该数值区域样式设置
  854. normal: {
  855. color: '#D87AFF', //背景颜色,还需设置areaStyle
  856. lineStyle: {
  857. color: '#2CC6FF', //边框颜色
  858. },
  859. },
  860. },
  861. label: { //显示value中具体的数值
  862. normal: {
  863. show: false,
  864. textStyle: { //更改数值样式
  865. color: '#43EDE3'
  866. }
  867. },
  868. },
  869. areaStyle: { //设置区域背景颜色透明度
  870. normal: {
  871. width: 1,
  872. opacity: 0.8,
  873. },
  874. },
  875. }
  876. ]
  877. }
  878. ]
  879. };
  880. tools.loopShowTooltip(myChart, option, {
  881. interval: 2000,
  882. loopSeries: true,
  883. });
  884. myChart.setOption(option)
  885. },
  886. // initChart5 () {
  887. // let myChart = echarts.init(this.$refs['echart5'])
  888. // let option = {
  889. // tooltip: {
  890. // formatter: data => {
  891. // 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}亿`
  892. // },
  893. // trigger: 'axis',
  894. // // axisPointer: {
  895. // // type: 'cross',
  896. // // },
  897. // },
  898. // grid: {
  899. // top: '16%',
  900. // right: '3%',
  901. // left: '3%',
  902. // bottom: '25%',
  903. // },
  904. // legend: {
  905. // data: ["预算额", "合同额", "结算额", "支付额"],
  906. // x: 'center',
  907. // y: '10px',
  908. // textStyle: {
  909. // color: 'rgba(250,250,250,0.6)',
  910. // },
  911. // },
  912. // xAxis: {
  913. // data: title.map(item => item.name),
  914. // axisLine: {
  915. // show: true, //隐藏X轴轴线
  916. // lineStyle: {
  917. // color: '#005094',
  918. // width: 1,
  919. // },
  920. // },
  921. // axisTick: {
  922. // show: false, //隐藏X轴刻度
  923. // },
  924. // axisLabel: {
  925. // show: true,
  926. // rotate: 40,
  927. // textStyle: {
  928. // color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  929. // },
  930. // },
  931. // },
  932. // yAxis: [
  933. // {
  934. // type: 'value',
  935. // name: '亿元',
  936. // nameTextStyle: {
  937. // color: 'rgba(255,255,255,0.6)',
  938. // },
  939. // splitLine: {
  940. // show: true,
  941. // lineStyle: {
  942. // color: '#68b4dd66',
  943. // type: 'dashed',
  944. // },
  945. // },
  946. // axisLine: {
  947. // show: true,
  948. // lineStyle: {
  949. // color: '#3D7495',
  950. // },
  951. // },
  952. // axisLabel: {
  953. // show: true,
  954. // textStyle: {
  955. // color: 'rgba(250,250,250,0.6)',
  956. // },
  957. // },
  958. // },
  959. // ],
  960. // series: [
  961. // {
  962. // name: '预算额',
  963. // type: 'bar',
  964. // barWidth: 10,
  965. // itemStyle: {
  966. // normal: {
  967. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  968. // {
  969. // offset: 0,
  970. // color: '#69c0ff',
  971. // },
  972. // {
  973. // offset: 1,
  974. // color: '#082550',
  975. // },
  976. // ]),
  977. // },
  978. // },
  979. // data: title.map(item => item.value),
  980. // },
  981. // {
  982. // name: '合同额',
  983. // type: 'bar',
  984. // barWidth: 10,
  985. // itemStyle: {
  986. // normal: {
  987. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  988. // {
  989. // offset: 0,
  990. // color: '#957DFF',
  991. // },
  992. // {
  993. // offset: 1,
  994. // color: '#082550',
  995. // },
  996. // ]),
  997. // },
  998. // },
  999. // data: title.map(item => item.value2),
  1000. // },
  1001. // {
  1002. // name: '结算额',
  1003. // type: 'bar',
  1004. // barWidth: 10,
  1005. // itemStyle: {
  1006. // normal: {
  1007. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1008. // {
  1009. // offset: 0,
  1010. // color: '#957DFF',
  1011. // },
  1012. // {
  1013. // offset: 1,
  1014. // color: '#082550',
  1015. // },
  1016. // ]),
  1017. // },
  1018. // },
  1019. // data: title.map(item => item.value3),
  1020. // },
  1021. // {
  1022. // name: '支付额',
  1023. // type: 'bar',
  1024. // barWidth: 10,
  1025. // itemStyle: {
  1026. // normal: {
  1027. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1028. // {
  1029. // offset: 0,
  1030. // color: '#957DFF',
  1031. // },
  1032. // {
  1033. // offset: 1,
  1034. // color: '#082550',
  1035. // },
  1036. // ]),
  1037. // },
  1038. // },
  1039. // data: title.map(item => item.value4),
  1040. // },
  1041. // ],
  1042. // }
  1043. // myChart.setOption(option)
  1044. // tools.loopShowTooltip(myChart, option, {
  1045. // nterval: 2000,
  1046. // loopSeries: true,
  1047. // })
  1048. // },
  1049. initChart5 () {
  1050. let myChart = echarts.init(this.$refs['echart5'])
  1051. let option = {
  1052. tooltip: {
  1053. formatter: data => {
  1054. 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}亿`
  1055. },
  1056. trigger: 'axis',
  1057. axisPointer: {
  1058. type: 'cross',
  1059. },
  1060. },
  1061. dataZoom: [
  1062. {
  1063. // start: 9,//默认为@
  1064. // end: 100,//黑认认为1@0
  1065. type: "slider",
  1066. show: false,
  1067. // xAxisIndex: [0]
  1068. handlesize: 0,//滑动条的 左右2个滑动条的大小
  1069. startValue: 8,// 初始显示值
  1070. endValue: 0,// 结束显示值
  1071. height: 10,//组件高度
  1072. left: "5%",
  1073. right: "4%",//右边的距离
  1074. bottom: "25%",//底边的距离
  1075. borderColor: "#939",
  1076. fillerColor: "#269cdb",
  1077. borderRadius: 5,
  1078. backgroundColor: "#33384b",//两边未选中的滑动条区域的额色
  1079. showDataShadow: false,//是否显示数据阴影
  1080. showDetail: false,//即拖拽时候是否显示详细数值信息
  1081. truerealtime: true,//是否实时更新
  1082. filterMode: "filter"
  1083. }, {
  1084. type: 'inside',
  1085. show: true,
  1086. start: 1,
  1087. end: 100
  1088. }
  1089. ],
  1090. grid: {
  1091. top: '20%',
  1092. right: '3%',
  1093. left: '5%',
  1094. bottom: '25%',
  1095. },
  1096. legend: {
  1097. data: ["预算额", "合同额", "结算额", "支付额"],
  1098. x: 'center',
  1099. y: '0px',
  1100. textStyle: {
  1101. color: 'rgba(250,250,250,0.6)',
  1102. },
  1103. },
  1104. xAxis: {
  1105. data: echart1.map(item => item.name),
  1106. axisLine: {
  1107. show: true, //隐藏X轴轴线
  1108. lineStyle: {
  1109. color: '#005094',
  1110. width: 1,
  1111. },
  1112. },
  1113. axisTick: {
  1114. show: false, //隐藏X轴刻度
  1115. },
  1116. axisLabel: {
  1117. show: true,
  1118. rotate: 40,
  1119. textStyle: {
  1120. color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
  1121. },
  1122. },
  1123. },
  1124. yAxis: [
  1125. {
  1126. type: 'value',
  1127. name: '亿元',
  1128. nameTextStyle: {
  1129. color: 'rgba(255,255,255,0.6)',
  1130. },
  1131. splitLine: {
  1132. show: true,
  1133. lineStyle: {
  1134. color: '#68b4dd66',
  1135. type: 'dashed',
  1136. },
  1137. },
  1138. axisLine: {
  1139. show: true,
  1140. lineStyle: {
  1141. color: '#3D7495',
  1142. },
  1143. },
  1144. axisLabel: {
  1145. show: true,
  1146. textStyle: {
  1147. color: 'rgba(250,250,250,0.6)',
  1148. },
  1149. },
  1150. },
  1151. ],
  1152. series: [
  1153. {
  1154. name: '预算额',
  1155. type: 'bar',
  1156. barWidth: 10,
  1157. itemStyle: {
  1158. normal: {
  1159. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1160. {
  1161. offset: 0,
  1162. color: '#71D5FF',
  1163. },
  1164. {
  1165. offset: 1,
  1166. color: '#082550',
  1167. },
  1168. ]),
  1169. },
  1170. },
  1171. data: echart5.map(item => item.value),
  1172. },
  1173. {
  1174. name: '合同额',
  1175. type: 'bar',
  1176. barWidth: 10,
  1177. itemStyle: {
  1178. normal: {
  1179. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1180. {
  1181. offset: 0,
  1182. color: '#4D6FF6',
  1183. },
  1184. {
  1185. offset: 1,
  1186. color: '#082550',
  1187. },
  1188. ]),
  1189. },
  1190. },
  1191. data: echart5.map(item => item.value2),
  1192. },
  1193. {
  1194. name: '结算额',
  1195. type: 'bar',
  1196. barWidth: 10,
  1197. itemStyle: {
  1198. normal: {
  1199. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1200. {
  1201. offset: 0,
  1202. color: '#877CFC',
  1203. },
  1204. {
  1205. offset: 1,
  1206. color: '#082550',
  1207. },
  1208. ]),
  1209. },
  1210. },
  1211. data: echart5.map(item => item.value3),
  1212. },
  1213. {
  1214. name: '支付额',
  1215. type: 'bar',
  1216. barWidth: 10,
  1217. itemStyle: {
  1218. normal: {
  1219. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1220. {
  1221. offset: 0,
  1222. color: '#52BF80',
  1223. },
  1224. {
  1225. offset: 1,
  1226. color: '#082550',
  1227. },
  1228. ]),
  1229. },
  1230. },
  1231. data: echart5.map(item => item.value4),
  1232. },
  1233. ],
  1234. }
  1235. myChart.setOption(option)
  1236. tools.loopShowTooltip(myChart, option, {
  1237. interval: 2000,
  1238. loopSeries: true,
  1239. })
  1240. let arr = echart1.map(item => item.value2)
  1241. this.timeOut3 = setInterval(function () {
  1242. let startValue = myChart.getModel().option.dataZoom[0].startValue;
  1243. let endValue = myChart.getModel().option.dataZoom[0].endValue;
  1244. let start = myChart.getModel().option.xAxis[0].data[startValue];//起始X轴
  1245. let end = myChart.getModel().option.xAxis[0].data[endValue];//结束X轴
  1246. // 每次向后滚动一个,最后一个从头开始。
  1247. // console.log(option.dataZoom[0].endValue);
  1248. if (option.dataZoom[0].endValue >= 9) {
  1249. option.dataZoom[0].endValue = 8
  1250. option.dataZoom[0].startValue = 0
  1251. } else {
  1252. option.dataZoom[0].endValue = option.dataZoom[0].endValue + 9
  1253. option.dataZoom[0].startValue = option.dataZoom[0].startValue + 9
  1254. }
  1255. // myChart.dispatchAction({
  1256. // type: 'showTip',
  1257. // seriesIndex: 0,
  1258. // dataIndex: startValue +1,
  1259. // });
  1260. myChart.setOption(option);
  1261. }, 18000);
  1262. },
  1263. },
  1264. })