minxisoptions.js 25 KB

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