minxisoptions.js 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. import echarts from 'echarts'
  2. export default {
  3. name: 'minxisoptions',
  4. computed: {
  5. getValues() {
  6. return (arr) => {
  7. const values = []
  8. const names = []
  9. if (arr.length > 0) {
  10. const arle = Object.keys(arr[0]).filter((itcv) => itcv !== 'name')
  11. arle.forEach((itcs) => {
  12. values.push([])
  13. })
  14. arr.forEach((iybv) => {
  15. for (const key in iybv) {
  16. if (iybv?.name) {
  17. if (key === 'name') {
  18. names.push(iybv[key])
  19. } else {
  20. const fdex = arle.findIndex((itcg) => itcg === key)
  21. values[fdex].push(iybv[key])
  22. }
  23. }
  24. }
  25. })
  26. }
  27. return { names, values }
  28. }
  29. },
  30. },
  31. data() {
  32. return {
  33. chartOne: {
  34. tooltip: {
  35. trigger: 'axis',
  36. axisPointer: {
  37. type: 'shadow',
  38. },
  39. },
  40. legend: {
  41. show: true,
  42. },
  43. xAxis: {
  44. type: 'category',
  45. data: [],
  46. axisLine: {
  47. lineStyle: {
  48. color: 'rgba(0,0,0,0.6)',
  49. },
  50. },
  51. axisLabel: {
  52. show: true,
  53. interval: 0,
  54. rotate: 50,
  55. inside: false,
  56. margin: 6,
  57. formatter: (val) => {
  58. if (val.length > 5) {
  59. return val.split('').splice(0, 5).join('') + '...'
  60. } else {
  61. return val
  62. }
  63. },
  64. },
  65. },
  66. grid: {
  67. left: 50,
  68. right: 30,
  69. bottom: 70,
  70. top: 30,
  71. },
  72. yAxis: {
  73. type: 'value',
  74. axisLine: {
  75. show: false,
  76. },
  77. axisTick: {
  78. show: false,
  79. },
  80. splitLine: {
  81. show: true,
  82. lineStyle: {
  83. color: 'rgba(0,0,0,0.1)',
  84. },
  85. },
  86. axisLabel: {
  87. textStyle: {
  88. fontFamily: 'Microsoft YaHei',
  89. // color: '#ccc',
  90. },
  91. },
  92. },
  93. series: [],
  94. },
  95. chartTwo: {
  96. tooltip: {
  97. trigger: 'axis',
  98. axisPointer: {
  99. type: 'shadow',
  100. },
  101. },
  102. legend: {
  103. show: true,
  104. },
  105. grid: {
  106. left: 20,
  107. right: 20,
  108. bottom: 30,
  109. top: 30,
  110. containLabel: true,
  111. },
  112. xAxis: {
  113. type: 'category',
  114. boundaryGap: false,
  115. data: [],
  116. },
  117. yAxis: {
  118. type: 'value',
  119. axisLine: {
  120. show: false,
  121. },
  122. axisTick: {
  123. show: false,
  124. },
  125. splitLine: {
  126. show: true,
  127. lineStyle: {
  128. color: 'rgba(0,0,0,0.1)',
  129. },
  130. },
  131. axisLabel: {
  132. textStyle: {
  133. fontFamily: 'Microsoft YaHei',
  134. // color: '#ccc',
  135. },
  136. },
  137. },
  138. series: [],
  139. },
  140. chartThree: {
  141. color: ['#bb7ec4', '#ffb74a', '#ff4a55', '#54c5eb', '#8675ff', '#dce0fa'],
  142. textStyle: {
  143. color: '#8a8a8a',
  144. fontSize: 13,
  145. },
  146. tooltip: {
  147. trigger: 'item',
  148. show: false,
  149. },
  150. legend: {
  151. orient: 'vertical',
  152. right: '150px',
  153. icon: 'circle',
  154. top: 50,
  155. textStyle: {
  156. color: '#8a8a8a',
  157. lineHeight: 10,
  158. },
  159. },
  160. series: [],
  161. },
  162. chartFour: {
  163. legend: {
  164. show: false,
  165. },
  166. xAxis: {
  167. type: 'category',
  168. data: [],
  169. axisLine: {
  170. lineStyle: {
  171. color: 'rgba(0,0,0,0.6)',
  172. },
  173. },
  174. axisLabel: {
  175. show: true,
  176. interval: 0,
  177. rotate: 0,
  178. inside: false,
  179. margin: 6,
  180. formatter: (val) => {
  181. if (val.length > 5) {
  182. return val.split('').splice(0, 5).join('') + '...'
  183. } else {
  184. return val
  185. }
  186. },
  187. },
  188. },
  189. grid: {
  190. left: 50,
  191. right: 30,
  192. bottom: 50,
  193. top: 30,
  194. },
  195. yAxis: {
  196. type: 'value',
  197. axisLine: {
  198. show: false,
  199. },
  200. axisTick: {
  201. show: false,
  202. },
  203. splitLine: {
  204. show: true,
  205. lineStyle: {
  206. color: 'rgba(0,0,0,0.1)',
  207. },
  208. },
  209. axisLabel: {
  210. textStyle: {
  211. fontFamily: 'Microsoft YaHei',
  212. // color: '#ccc',
  213. },
  214. },
  215. },
  216. series: [],
  217. },
  218. chartFive: {
  219. tooltip: {
  220. trigger: 'axis',
  221. axisPointer: {
  222. type: 'shadow',
  223. },
  224. },
  225. legend: {
  226. show: true,
  227. },
  228. xAxis: [
  229. {
  230. type: 'category',
  231. data: [],
  232. axisLine: {
  233. lineStyle: {
  234. color: 'rgba(0,0,0,0.6)',
  235. },
  236. },
  237. axisLabel: {
  238. show: true,
  239. interval: 0,
  240. rotate: 0,
  241. inside: false,
  242. margin: 6,
  243. formatter: (val) => {
  244. if (val.length > 5) {
  245. return val.split('').splice(0, 5).join('') + '...'
  246. } else {
  247. return val
  248. }
  249. },
  250. },
  251. },
  252. {
  253. type: 'value',
  254. max: 0,
  255. show: false,
  256. },
  257. ],
  258. grid: {
  259. left: 50,
  260. right: 30,
  261. bottom: 50,
  262. top: 30,
  263. },
  264. yAxis: {
  265. type: 'value',
  266. axisLine: {
  267. show: false,
  268. },
  269. axisTick: {
  270. show: false,
  271. },
  272. splitLine: {
  273. show: true,
  274. lineStyle: {
  275. color: 'rgba(0,0,0,0.1)',
  276. },
  277. },
  278. axisLabel: {
  279. textStyle: {
  280. fontFamily: 'Microsoft YaHei',
  281. // color: '#ccc',
  282. },
  283. },
  284. },
  285. series: [],
  286. },
  287. chartSex: {
  288. color: ['#ff7f5c', '#163bf5', '#f14249', '#2fc666', '#ffd72c'],
  289. tooltip: {
  290. trigger: 'item',
  291. },
  292. legend: {
  293. show: true,
  294. orient: 'vertical',
  295. right: '40%',
  296. icon: 'circle',
  297. top: '50%',
  298. textStyle: {
  299. color: '#000',
  300. rich: {
  301. a: {
  302. width: 50,
  303. padding: [0, 14, 0, 0],
  304. },
  305. b: {
  306. align: 'left',
  307. width: 40,
  308. padding: [0, 10, 0, 0],
  309. },
  310. c: {
  311. align: 'left',
  312. },
  313. },
  314. },
  315. },
  316. series: [],
  317. },
  318. chartSeven: {
  319. tooltip: {
  320. trigger: 'axis',
  321. axisPointer: {
  322. type: 'shadow',
  323. },
  324. },
  325. legend: {
  326. show: true,
  327. },
  328. xAxis: [
  329. {
  330. type: 'category',
  331. data: [],
  332. axisLine: {
  333. lineStyle: {
  334. color: 'rgba(0,0,0,0.6)',
  335. },
  336. },
  337. axisLabel: {
  338. show: true,
  339. interval: 0,
  340. rotate: 0,
  341. inside: false,
  342. margin: 6,
  343. formatter: (val) => {
  344. if (val.length > 5) {
  345. return val.split('').splice(0, 5).join('') + '...'
  346. } else {
  347. return val
  348. }
  349. },
  350. },
  351. },
  352. {
  353. type: 'value',
  354. max: 0,
  355. show: false,
  356. },
  357. ],
  358. grid: {
  359. left: 50,
  360. right: 30,
  361. bottom: 50,
  362. top: 30,
  363. },
  364. yAxis: {
  365. type: 'value',
  366. axisLine: {
  367. show: false,
  368. },
  369. axisTick: {
  370. show: false,
  371. },
  372. splitLine: {
  373. show: true,
  374. lineStyle: {
  375. color: 'rgba(0,0,0,0.1)',
  376. },
  377. },
  378. axisLabel: {
  379. textStyle: {
  380. fontFamily: 'Microsoft YaHei',
  381. // color: '#ccc',
  382. },
  383. },
  384. },
  385. series: [],
  386. },
  387. chartEight: {
  388. color: ['#ff7f5c', '#163bf5', '#f14249', '#2fc666', '#ffd72c'],
  389. tooltip: {
  390. trigger: 'item',
  391. },
  392. legend: {
  393. show: true,
  394. orient: 'vertical',
  395. right: '40%',
  396. icon: 'circle',
  397. top: '50%',
  398. textStyle: {
  399. color: '#000',
  400. rich: {
  401. a: {
  402. width: 50,
  403. padding: [0, 14, 0, 0],
  404. },
  405. b: {
  406. align: 'left',
  407. width: 40,
  408. padding: [0, 10, 0, 0],
  409. },
  410. c: {
  411. align: 'left',
  412. },
  413. },
  414. },
  415. },
  416. series: [],
  417. },
  418. }
  419. },
  420. methods: {
  421. oneChartsMap(datas) {
  422. const series = []
  423. const { names, values } = this.getValues(datas)
  424. const tabline = [
  425. {
  426. name: '发现问题数',
  427. color: ['#e7474e', '#eb4442'],
  428. data: values[0] || 0,
  429. },
  430. {
  431. name: '到期整改问题数',
  432. color: ['#2dc84e', '#2ac689'],
  433. data: values[1] || 0,
  434. },
  435. {
  436. name: '零容忍问题数',
  437. color: ['#ffd619', '#f9d632'],
  438. data: values[2] || 0,
  439. },
  440. ]
  441. // console.log(tabline, '数据-------tabline')
  442. const styles = []
  443. tabline.forEach((itvb, indexv) => {
  444. const styArr = []
  445. itvb.color.forEach((itvn, inde) => {
  446. styArr.push({ offset: inde, color: itvn })
  447. })
  448. styles.push(styArr)
  449. })
  450. tabline.forEach((itcs, index) => {
  451. series.push({
  452. name: itcs.name,
  453. type: 'bar',
  454. barWidth: '15%',
  455. itemStyle: {
  456. normal: {
  457. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, styles[index]),
  458. barBorderRadius: [12, 12, 0, 0],
  459. },
  460. },
  461. data: itcs.data,
  462. })
  463. })
  464. this.chartOne.xAxis.data = names
  465. this.chartOne.series = series
  466. // console.log('数据----ce', series)
  467. },
  468. twoChartMap(datas) {
  469. const tabline = ['年度发现问题数趋势', '零容忍问题数']
  470. const colors = ['rgba(191, 121, 131,1)', 'rgba(225, 217, 68,1)']
  471. // const colors = ['rgba(191, 121, 131,1)', 'rgba(225, 217, 68,1)', 'rgba(103, 152, 183,1)']
  472. const series = []
  473. const { names, values } = this.getValues(datas)
  474. values.forEach((itcs, index) => {
  475. series.push({
  476. name: tabline[index],
  477. type: 'line',
  478. showAllSymbol: true,
  479. symbol: 'circle',
  480. symbolSize: 8,
  481. lineStyle: {
  482. color: colors[index], // 线条颜色
  483. normal: {
  484. color: colors[index], // 线条颜色
  485. },
  486. },
  487. label: {
  488. show: false,
  489. position: 'top',
  490. textStyle: {
  491. color: '#fff',
  492. },
  493. },
  494. itemStyle: {
  495. normal: {
  496. color: colors[index],
  497. },
  498. },
  499. tooltip: {
  500. show: true,
  501. },
  502. areaStyle: {
  503. // 区域填充样式
  504. normal: {
  505. color: {
  506. type: 'linear',
  507. x: 0,
  508. y: 0,
  509. x2: 0,
  510. y2: 1,
  511. colorStops: [
  512. {
  513. offset: 0,
  514. color: colors[index], // 0% 处的颜色
  515. },
  516. {
  517. offset: 0.4,
  518. color: colors[index].replace('1)', '0.1)'), // 0% 处的颜色
  519. },
  520. {
  521. offset: 1,
  522. color: 'rgba(255,255,255,0)',
  523. },
  524. ],
  525. global: false, // 缺省为 false
  526. },
  527. },
  528. },
  529. data: values[index],
  530. })
  531. })
  532. this.chartTwo.xAxis.data = names
  533. this.chartTwo.series = series
  534. },
  535. threeChartMap(datas) {
  536. let nums = 0
  537. datas.forEach((itb) => {
  538. nums += itb.value * 1
  539. })
  540. const series = []
  541. series.push({
  542. type: 'pie',
  543. center: ['25%', '50%'],
  544. radius: ['50%', '70%'],
  545. label: {
  546. show: true,
  547. fontSize: 15,
  548. fontWeight: '600',
  549. // color: '#fff',
  550. position: 'outside',
  551. formatter: function (item) {
  552. return `${((item.value / nums) * 100).toFixed(2)}%`
  553. },
  554. },
  555. emphasis: {
  556. disabled: true,
  557. scale: true,
  558. scaleSize: 0,
  559. },
  560. tooltip: {
  561. show: false,
  562. },
  563. labelLine: {
  564. show: true,
  565. },
  566. data: datas,
  567. })
  568. const legend = {
  569. show: true,
  570. orient: 'vertical',
  571. right: '10%',
  572. icon: 'circle',
  573. formatter: function (name) {
  574. const indexs = datas.findIndex((itcs) => itcs.name === name)
  575. return `{a|${datas[indexs].name}}{b|${datas[indexs].value}万元}`
  576. },
  577. top: '5%',
  578. textStyle: {
  579. color: '#000',
  580. rich: {
  581. a: {
  582. width: 160,
  583. padding: [0, 14, 0, 0],
  584. },
  585. b: {
  586. align: 'left',
  587. width: 60,
  588. padding: [0, 10, 0, 0],
  589. },
  590. },
  591. },
  592. }
  593. // series[0].data = nameArr
  594. // 设置总条数
  595. this.chartThree.title = {
  596. text: nums.toFixed(2),
  597. subtext: '金额总计(万元)',
  598. left: '25%',
  599. textAlign: 'center',
  600. top: 'center',
  601. }
  602. this.chartThree.series = series
  603. this.chartThree.legend = legend
  604. },
  605. fourChartMap(datas) {
  606. debugger
  607. const series = []
  608. const { names, values } = this.getValues(datas)
  609. const valuec = values[0]
  610. const arrc = [[], [], [], [], []]
  611. const arrcName = [[], [], [], [], []]
  612. // if (valuec) {
  613. // valuec.forEach((itc) => {
  614. // itc.forEach((itcv, index) => {
  615. // if (itcv.label) {
  616. // arrc[index].push(itcv.value || 0)
  617. // arrcName[index].push(itcv.label)
  618. // }
  619. // })
  620. // })
  621. // }
  622. if (valuec) {
  623. valuec.forEach((itc) => {
  624. itc.forEach((itcv, index) => {
  625. // if (itcv.label) {
  626. arrc[index].push(itcv.value)
  627. arrcName[index].push(itcv.label)
  628. // }
  629. })
  630. })
  631. }
  632. const tabline = []
  633. const colorsc = ['#d55d6e', '#edd43e', '#6fa6da', '#5459c1', '#23459c']
  634. arrc.forEach((itcvc, indexc) => {
  635. if (itcvc) {
  636. tabline.push({ name: `TOP${indexc * 1 + 1}`, data: itcvc, color: colorsc[indexc] })
  637. }
  638. })
  639. tabline.forEach((itcs, index) => {
  640. series.push({
  641. name: itcs.name,
  642. barGap: 0.1,
  643. type: 'bar',
  644. itemStyle: {
  645. normal: {
  646. color: itcs.color,
  647. barBorderRadius: [12, 12, 0, 0],
  648. },
  649. },
  650. data: itcs.data,
  651. })
  652. })
  653. this.chartFour.tooltip = {
  654. trigger: 'axis',
  655. axisPointer: {
  656. type: 'shadow',
  657. },
  658. formatter: (val) => {
  659. let str = ''
  660. let searName = []
  661. val.forEach((itc) => {
  662. const newArrs = arrcName.filter((itcvc) => itcvc[itc.dataIndex])
  663. searName = newArrs.map((ityv, indx) => {
  664. return { name: ityv[itc.dataIndex], value: arrc[indx][itc.dataIndex] }
  665. })
  666. })
  667. searName.forEach((itcc, indec) => {
  668. if (itcc?.name) {
  669. str += `<div style="display:flex;align-items:center;"><span style="width:10px;height:10px;border-radius:100%;background-color:${val[indec]?.color};"></span><span style="padding-left:5px">${itcc.name}:${itcc.value}</span></div>`
  670. }
  671. })
  672. return val[0]?.axisValue ? `<div>${val[0]?.axisValue}</div>${str}` : ''
  673. },
  674. }
  675. this.chartFour.xAxis.data = names
  676. this.chartFour.series = series
  677. },
  678. fiveChartsMap(datas) {
  679. // debugger
  680. const series = []
  681. const { names, values } = this.getValues(datas)
  682. // console.log(names, values, ' names, values ---')
  683. const tabline = [
  684. // {
  685. // name: '增收节支',
  686. // color: ['#eb4442'],
  687. // data: values[0],
  688. // },
  689. {
  690. name: '新建、修订制度、流程、标准数量',
  691. color: ['#2390f5'],
  692. data: values[0],
  693. },
  694. // {
  695. // name: '整改完成率',
  696. // color: ['#29c886'],
  697. // data: values[2],
  698. // },
  699. {
  700. name: '追责问责(人次)',
  701. color: ['#fdd267'],
  702. data: values[1],
  703. },
  704. ]
  705. const styles = []
  706. tabline.forEach((itvb, indexv) => {
  707. const styArr = []
  708. itvb.color.forEach((itvn, inde) => {
  709. styArr.push({ offset: inde, color: itvn })
  710. })
  711. styles.push(styArr)
  712. })
  713. const bars = []
  714. const lines = []
  715. tabline.forEach((itcs, index) => {
  716. bars.push({
  717. name: itcs.name,
  718. type: 'bar',
  719. barWidth: '15%',
  720. itemStyle: {
  721. normal: {
  722. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, styles[index]),
  723. barBorderRadius: [12, 12, 0, 0],
  724. },
  725. },
  726. data: itcs.data,
  727. })
  728. })
  729. // lines.push({
  730. // name: '总计',
  731. // type: 'line',
  732. // symbol: 'circle',
  733. // symbolSize: 10,
  734. // smooth: true,
  735. // animationDuration: 2000,
  736. // legend: {
  737. // show: false,
  738. // },
  739. // lineStyle: {
  740. // normal: {
  741. // color: '#cb4445', // 线条颜色
  742. // },
  743. // borderColor: '#cb4445',
  744. // },
  745. // label: {
  746. // show: false,
  747. // position: 'top',
  748. // textStyle: {
  749. // color: '#fff',
  750. // },
  751. // },
  752. // itemStyle: {
  753. // normal: {
  754. // color: '#cb4445',
  755. // },
  756. // },
  757. // tooltip: {
  758. // show: true,
  759. // },
  760. // data: names.map((itcv, indec) => {
  761. // let nums = 0
  762. // values.forEach((itvb) => {
  763. // nums += itvb[indec] * 1
  764. // })
  765. // return nums
  766. // }),
  767. // })
  768. this.chartFive.xAxis[0].data = names
  769. this.chartFive.series = [...bars, ...lines]
  770. },
  771. SevenChartsMap(datas) {
  772. const series = []
  773. const { names, values } = this.getValues(datas)
  774. const tabline = [
  775. //
  776. {
  777. name: '新建、修订制度、流程、标准数量',
  778. color: ['#2390f5'],
  779. data: values[0],
  780. },
  781. //
  782. {
  783. name: '追责问责(人次)',
  784. color: ['#fdd267'],
  785. data: values[1],
  786. },
  787. ]
  788. const styles = []
  789. tabline.forEach((itvb, indexv) => {
  790. const styArr = []
  791. itvb.color.forEach((itvn, inde) => {
  792. styArr.push({ offset: inde, color: itvn })
  793. })
  794. styles.push(styArr)
  795. })
  796. const bars = []
  797. const lines = []
  798. tabline.forEach((itcs, index) => {
  799. bars.push({
  800. name: itcs.name,
  801. type: 'bar',
  802. barWidth: '15%',
  803. itemStyle: {
  804. normal: {
  805. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, styles[index]),
  806. barBorderRadius: [12, 12, 0, 0],
  807. },
  808. },
  809. data: itcs.data,
  810. })
  811. })
  812. this.chartSeven.xAxis[0].data = names
  813. this.chartSeven.series = [...bars, ...lines]
  814. },
  815. sexChartsMap(datas) {
  816. let nums = 0
  817. datas.forEach((itb) => {
  818. nums += itb.value * 1
  819. })
  820. const series = []
  821. series.push({
  822. type: 'pie',
  823. center: ['25%', '50%'],
  824. radius: ['50%', '70%'],
  825. label: {
  826. show: true,
  827. fontSize: 15,
  828. fontWeight: '600',
  829. // color: '#fff',
  830. position: 'outside',
  831. formatter: function (item) {
  832. return `${((item.value / nums) * 100).toFixed(1)}%`
  833. },
  834. },
  835. emphasis: {
  836. disabled: true,
  837. scale: true,
  838. scaleSize: 0,
  839. },
  840. tooltip: {
  841. show: false,
  842. },
  843. labelLine: {
  844. show: true,
  845. },
  846. data: datas,
  847. })
  848. const legend = {
  849. show: true,
  850. orient: 'vertical',
  851. right: '10%',
  852. icon: 'circle',
  853. formatter: function (name) {
  854. const indexs = datas.findIndex((itcs) => itcs.name === name)
  855. return `{a|${datas[indexs].name}}{b|${datas[indexs].value}条}{c|${datas[indexs].value2}万元}`
  856. },
  857. top: '35%',
  858. textStyle: {
  859. color: '#000',
  860. rich: {
  861. a: {
  862. width: 60,
  863. padding: [0, 14, 0, 0],
  864. },
  865. b: {
  866. align: 'left',
  867. width: 40,
  868. padding: [0, 10, 0, 0],
  869. },
  870. c: {
  871. align: 'left',
  872. },
  873. },
  874. },
  875. }
  876. // series[0].data = nameArr
  877. // 设置总条数
  878. this.chartSex.title = {
  879. text: nums,
  880. subtext: '总整改数(条)',
  881. left: '25%',
  882. top: 'center',
  883. textAlign: 'center',
  884. }
  885. this.chartSex.series = series
  886. this.chartSex.legend = legend
  887. },
  888. eightChartsMap(datas) {
  889. let nums = 0
  890. datas.forEach((itb) => {
  891. nums += itb.value * 1
  892. })
  893. const series = []
  894. series.push({
  895. type: 'pie',
  896. center: ['25%', '50%'],
  897. radius: ['50%', '70%'],
  898. label: {
  899. show: true,
  900. fontSize: 15,
  901. fontWeight: '600',
  902. // color: '#fff',
  903. position: 'outside',
  904. formatter: function (item) {
  905. return `${((item.value / nums) * 100).toFixed(1)}%`
  906. },
  907. },
  908. emphasis: {
  909. disabled: true,
  910. scale: true,
  911. scaleSize: 0,
  912. },
  913. tooltip: {
  914. show: false,
  915. },
  916. labelLine: {
  917. show: true,
  918. },
  919. data: datas,
  920. })
  921. const legend = {
  922. show: true,
  923. orient: 'vertical',
  924. right: '10%',
  925. icon: 'circle',
  926. formatter: function (name) {
  927. const indexs = datas.findIndex((itcs) => itcs.name === name)
  928. return `{a|${datas[indexs].name}}{b|${datas[indexs].value}条}{c|${datas[indexs].value2}万元}`
  929. },
  930. top: '35%',
  931. textStyle: {
  932. color: '#000',
  933. rich: {
  934. a: {
  935. width: 60,
  936. padding: [0, 14, 0, 0],
  937. },
  938. b: {
  939. align: 'left',
  940. width: 40,
  941. padding: [0, 10, 0, 0],
  942. },
  943. c: {
  944. align: 'left',
  945. },
  946. },
  947. },
  948. }
  949. // series[0].data = nameArr
  950. // 设置总条数
  951. this.chartEight.title = {
  952. text: nums,
  953. subtext: '总整改数(条)',
  954. left: '25%',
  955. top: 'center',
  956. textAlign: 'center',
  957. }
  958. this.chartEight.series = series
  959. this.chartEight.legend = legend
  960. },
  961. changeLegend(params) {
  962. // const _thant = this
  963. // const arrs = this.chartFive.series.filter((itcs) => itcs.xAxisIndex && itcs.xAxisIndex === 1)
  964. // const newArr = arrs.filter((itvc) => params.selected[itvc.name])
  965. // for (const key in newArr) {
  966. // const num = Number(key) + 20
  967. // newArr[key].data = newArr[key].data.map((itcv, indec) => {
  968. // itcv[0] = num + indec * 100
  969. // return itcv
  970. // })
  971. // console.log(newArr, 'arr----')
  972. // }
  973. // newArr.forEach((itcx) => {
  974. // const indesx = _thant.chartFive.series.findIndex(
  975. // (ityv) => ityv?.xAxisIndex === 1 && ityv.name === itcx.name
  976. // )
  977. // if (indesx !== -1) {
  978. // _thant.chartFive.series[indesx] = itcx
  979. // }
  980. // })
  981. // console.log(newArr, 'paramsparamsparamsparams')
  982. },
  983. },
  984. }