chart.js 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. // 绘制中间动态环图
  2. const drawWorkShopChart = (datas) => {
  3. const options = [];
  4. let number = 50;
  5. datas.forEach((item) => {
  6. const obj = { value: number, name: item.name,...item };
  7. options.push(obj);
  8. number += 10;
  9. });
  10. const workShopOption = {
  11. series: [
  12. {
  13. name: 'pie',
  14. type: 'pie',
  15. width: "80%",
  16. height: "55%",
  17. center: ['50%', '50%'],
  18. top: "center",
  19. radius: ['54%', '90%'],
  20. avoidLabelOverlap: false,
  21. hoverAnimation: false,
  22. padAngle: 5,
  23. itemStyle: {
  24. borderRadius: 10,
  25. },
  26. label: {
  27. show: false,
  28. position: 'center'
  29. },
  30. labelLine: {
  31. show: false
  32. },
  33. selectedMode: 'single',
  34. selectedOffset: 6,
  35. // 选中的样式
  36. select: {
  37. label: {
  38. show: true,
  39. fontSize: 20,
  40. fontWeight: 'bold',
  41. color: "#ffffff"
  42. },
  43. },
  44. data: options,
  45. }
  46. ]
  47. };
  48. return workShopOption
  49. }
  50. // 绘制模检具故障数量图
  51. const drawMalfunctionNumber = () => {
  52. let category = [
  53. {
  54. name: "检具近三十天故障数量",
  55. value: 0,
  56. },
  57. {
  58. name: "模具近三十天故障数量",
  59. value: 0,
  60. },
  61. ]
  62. let yName = [];
  63. let bgData = [];
  64. let number = []
  65. let maxValue = 500; //最大值
  66. category.forEach(element => {
  67. yName.push(element.name);
  68. number.push({ name: element.name, value: element.value + '个' })
  69. bgData.push({
  70. name: element.name,
  71. value: maxValue,
  72. type: element.type,
  73. });
  74. });
  75. const malfunctionNumberOption = {
  76. xAxis: {
  77. // max: maxValue,
  78. splitLine: {
  79. show: false
  80. },
  81. axisLine: {
  82. show: false
  83. },
  84. axisLabel: {
  85. show: false
  86. },
  87. axisTick: {
  88. show: false
  89. }
  90. },
  91. grid: {
  92. left: 150,
  93. top: 20,
  94. right: 80,
  95. bottom: 20
  96. },
  97. yAxis: [
  98. { // y轴最左侧的文字
  99. axisTick: 'none',
  100. axisLine: 'none',
  101. position: 'left',
  102. axisLabel: {
  103. padding: [0, 0, 0, 0],
  104. textStyle: {
  105. color: '#ffffff',
  106. fontSize: '12',
  107. }
  108. },
  109. data: yName
  110. },
  111. { // y轴最右侧的文字
  112. name: 'right',
  113. axisTick: 'none',
  114. axisLine: 'none',
  115. type: 'category',
  116. position: 'right',
  117. axisLabel: {
  118. margin: 10,
  119. textStyle: {
  120. color: '#ffffff',
  121. fontSize: '12',
  122. }
  123. },
  124. data: number,
  125. }],
  126. series: [
  127. {
  128. // 背景样式
  129. name: '背景',
  130. type: "bar",
  131. barWidth: 18,
  132. stack: '总量',
  133. barGap: '-100%',
  134. symbol: 'fixed',
  135. symbolRepeat: 'repeat',
  136. legendHoverLink: false,
  137. itemStyle: {
  138. normal: {
  139. color: '#131943'
  140. }
  141. },
  142. data: bgData,
  143. animation: false, //关闭动画
  144. z: 0
  145. },
  146. {
  147. name: '故障数量',
  148. // 内(显示的内容)
  149. type: "bar",
  150. barGap: '-100%',
  151. barWidth: 18,
  152. legendHoverLink: false,
  153. silent: true,
  154. itemStyle: {
  155. normal: {
  156. color: {
  157. type: "linear",
  158. x: 0,
  159. y: 0,
  160. x2: 1,
  161. y2: 0,
  162. colorStops: [{
  163. offset: 0,
  164. color: '#53aee6' // 0% 处的颜色
  165. },
  166. {
  167. offset: 1,
  168. color: '#ef1dfc' // 100% 处的颜色
  169. }
  170. ]
  171. }
  172. }
  173. },
  174. data: category,
  175. z: 1,
  176. animationEasing: "elasticOut"
  177. },
  178. {
  179. // 分隔
  180. type: "pictorialBar",
  181. itemStyle: {
  182. normal: {
  183. color: 'rgba(0,0,0,1)'
  184. }
  185. },
  186. symbolRepeat: "fixed",
  187. symbolMargin: '300%',
  188. symbol: "rect",
  189. symbolClip: true,
  190. symbolSize: [5, 21],
  191. symbolPosition: "start",
  192. symbolOffset: [0, 0],
  193. symbolBoundingData: maxValue,
  194. data: bgData,
  195. animation: false, //关闭动画
  196. z: 2
  197. }
  198. ]
  199. };
  200. return malfunctionNumberOption
  201. }
  202. // 绘制模检具故障趋势折线图
  203. const drawMalfunctionChart = () => {
  204. let stateData = {
  205. xData: [],
  206. yData1: [],
  207. yData2: [],
  208. };
  209. const option = {
  210. tooltip: {},
  211. legend: {
  212. itemWidth: 7,
  213. itemHeight: 7,
  214. icon: "rect",
  215. right: 0,
  216. textStyle: {
  217. fontSize: 12,
  218. fontFamily: "PingFangSC, PingFang SC",
  219. fontWeight: 400,
  220. color: "#ffffff",
  221. },
  222. orient: "vertical",
  223. top: "0",
  224. },
  225. xAxis: {
  226. name: "月份",
  227. type: "category",
  228. boundaryGap: false,
  229. data: stateData.xData,
  230. nameTextStyle: {
  231. fontSize: 12,
  232. fontFamily: "PingFangSC, PingFang SC",
  233. fontWeight: 400,
  234. color: "#ffffff",
  235. },
  236. axisLabel: {
  237. fontSize: 12,
  238. fontFamily: "PingFangSC, PingFang SC",
  239. fontWeight: 400,
  240. color: "#ffffff",
  241. },
  242. },
  243. yAxis: {
  244. type: "value",
  245. name: "数量",
  246. nameTextStyle: {
  247. fontSize: 12,
  248. fontFamily: "PingFangSC, PingFang SC",
  249. fontWeight: 400,
  250. color: "#ffffff",
  251. },
  252. axisLabel: {
  253. fontSize: 12,
  254. fontFamily: "PingFangSC, PingFang SC",
  255. fontWeight: 400,
  256. color: "#ffffff",
  257. },
  258. splitLine: {
  259. lineStyle: {
  260. color: "#5f5f5f",
  261. },
  262. },
  263. },
  264. series: [
  265. {
  266. name: "模具故障趋势",
  267. data: stateData.yData1,
  268. type: "line",
  269. smooth: true,
  270. label: {
  271. show: true,
  272. position: "top",
  273. color: '#f20d0d'
  274. },
  275. itemStyle: {
  276. normal: {
  277. color: "#f20d0d",
  278. lineStyle: {
  279. color: "#f20d0d",
  280. width: 2,
  281. },
  282. areaStyle: {
  283. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  284. {
  285. offset: 0,
  286. color: "#2d0838",
  287. },
  288. {
  289. offset: 1,
  290. color: "#43072f",
  291. },
  292. ]),
  293. },
  294. },
  295. },
  296. },
  297. {
  298. name: "检具故障趋势",
  299. data: stateData.yData2,
  300. type: "line",
  301. smooth: true,
  302. label: {
  303. show: true,
  304. position: "top",
  305. color: '#5fafff'
  306. },
  307. itemStyle: {
  308. normal: {
  309. color: "rgba(95, 175, 255, 1)",
  310. lineStyle: {
  311. color: "rgba(95, 175, 255, 1)",
  312. width: 2,
  313. },
  314. areaStyle: {
  315. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  316. {
  317. offset: 0,
  318. color: "rgba(95, 175, 255, 0)",
  319. },
  320. {
  321. offset: 1,
  322. color: "rgba(95, 175, 255, 1)",
  323. },
  324. ]),
  325. },
  326. },
  327. },
  328. },
  329. ],
  330. };
  331. return option
  332. }
  333. // 绘制模具维修时效柱状图
  334. const drawMaintainChart = () => {
  335. let xData = ['一天内', '两天内', '三天内', '三天以上',]
  336. let yData = []
  337. const offsetX = 20;
  338. const offsetY = 10;
  339. // 绘制立体左侧面
  340. const CubeLeft = echarts.graphic.extendShape({
  341. shape: {
  342. x: 0,
  343. y: 0,
  344. },
  345. buildPath: function (ctx, shape) {
  346. const xAxisPoint = shape.xAxisPoint;
  347. const c0 = [shape.x, shape.y];
  348. const c1 = [shape.x - offsetX, shape.y - offsetY];
  349. const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
  350. const c3 = [xAxisPoint[0], xAxisPoint[1]];
  351. ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath();
  352. },
  353. });
  354. // 绘制立体右侧面
  355. const CubeRight = echarts.graphic.extendShape({
  356. shape: {
  357. x: 0,
  358. y: 0,
  359. },
  360. buildPath: function (ctx, shape) {
  361. const xAxisPoint = shape.xAxisPoint;
  362. const c1 = [shape.x, shape.y];
  363. const c2 = [xAxisPoint[0], xAxisPoint[1]];
  364. const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY];
  365. const c4 = [shape.x + offsetX, shape.y - offsetY];
  366. ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
  367. },
  368. });
  369. // 绘制立体顶面
  370. const CubeTop = echarts.graphic.extendShape({
  371. shape: {
  372. x: 0,
  373. y: 0,
  374. },
  375. buildPath: function (ctx, shape) {
  376. const c1 = [shape.x, shape.y];
  377. const c2 = [shape.x + offsetX, shape.y - offsetY]; //右点
  378. const c3 = [shape.x, shape.y - offsetX];
  379. const c4 = [shape.x - offsetX, shape.y - offsetY];
  380. ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
  381. },
  382. });
  383. // 注册三个面图形
  384. echarts.graphic.registerShape('CubeLeft', CubeLeft);
  385. echarts.graphic.registerShape('CubeRight', CubeRight);
  386. echarts.graphic.registerShape('CubeTop', CubeTop);
  387. const option = {
  388. tooltip: {
  389. trigger: 'axis',
  390. axisPointer: {
  391. type: 'shadow',
  392. },
  393. formatter: function (params, ticket, callback) {
  394. const item = params[1];
  395. return item.name + ' : ' + item.value;
  396. },
  397. },
  398. grid: {
  399. left: '10%',
  400. right: '10%',
  401. top: '15%',
  402. bottom: '10%',
  403. containLabel: true,
  404. },
  405. textStyle: {
  406. color: '#ffffff',
  407. },
  408. xAxis: {
  409. name: '天数',
  410. type: 'category',
  411. data: xData,
  412. axisLine: {
  413. lineStyle: {
  414. color: '#dddddd',
  415. },
  416. },
  417. axisTick: {
  418. show: false,
  419. },
  420. axisLabel: {
  421. margin: 10, //刻度标签与轴线之间的距离。
  422. textStyle: {
  423. fontFamily: 'Microsoft YaHei',
  424. color: '#ffffff',
  425. },
  426. },
  427. },
  428. yAxis: {
  429. name: "数量",
  430. nameTextStyle: {
  431. verticalAlign: 'middle',
  432. align: "right"
  433. },
  434. type: 'value',
  435. min: 0,
  436. boundaryGap: ['20%', '60%'],
  437. axisLine: {
  438. show: true,
  439. lineStyle: {
  440. color: '#ddddddd',
  441. },
  442. },
  443. splitLine: {
  444. lineStyle: {
  445. // 使用深浅的间隔色
  446. color: ['#B5B5B5'],
  447. type: 'dashed',
  448. opacity: 0.5,
  449. },
  450. },
  451. },
  452. series: [
  453. {
  454. type: 'custom',
  455. name: '时效',
  456. renderItem: (params, api) => {
  457. const location = api.coord([api.value(0), api.value(1)]);
  458. return {
  459. type: 'group',
  460. children: [
  461. {
  462. type: 'CubeLeft',
  463. shape: {
  464. api,
  465. xValue: api.value(0),
  466. yValue: api.value(1),
  467. x: location[0],
  468. y: location[1],
  469. xAxisPoint: api.coord([api.value(0), 0]),
  470. },
  471. style: {
  472. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  473. {
  474. offset: 0,
  475. color: '#ff0101',
  476. },
  477. {
  478. offset: 1,
  479. color: '#5c0001',
  480. },
  481. ]),
  482. },
  483. },
  484. {
  485. type: 'CubeRight',
  486. shape: {
  487. api,
  488. xValue: api.value(0),
  489. yValue: api.value(1),
  490. x: location[0],
  491. y: location[1],
  492. xAxisPoint: api.coord([api.value(0), 0]),
  493. },
  494. style: {
  495. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  496. {
  497. offset: 0,
  498. color: '#ff0101',
  499. },
  500. {
  501. offset: 1,
  502. color: '#5c0001',
  503. },
  504. ]),
  505. },
  506. },
  507. {
  508. type: 'CubeTop',
  509. shape: {
  510. api,
  511. xValue: api.value(0),
  512. yValue: api.value(1),
  513. x: location[0],
  514. y: location[1],
  515. xAxisPoint: api.coord([api.value(0), 0]),
  516. },
  517. style: {
  518. fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  519. {
  520. offset: 0,
  521. color: '#ff0101',
  522. },
  523. {
  524. offset: 1,
  525. color: '#5c0001',
  526. },
  527. ]),
  528. },
  529. },
  530. ],
  531. };
  532. },
  533. data: yData,
  534. },
  535. {
  536. type: 'bar',
  537. name: '百分比',
  538. label: {
  539. normal: {
  540. show: true,
  541. position: 'top',
  542. formatter: (e) => {
  543. return e.value / 1000 * 100 + '%';
  544. },
  545. fontSize: 12,
  546. color: '#ffffff',
  547. offset: [0, -10],
  548. },
  549. },
  550. itemStyle: {
  551. color: 'transparent',
  552. },
  553. data: yData,
  554. },
  555. ],
  556. };
  557. return option
  558. }
  559. // 绘制近七天模检具出入库胶囊柱图
  560. const drawOutInChart = () => {
  561. const xData = []
  562. const yData = [
  563. "模具入库总数",
  564. "模具出库总数",
  565. "检具入库总数",
  566. "检具出库总数",
  567. ]
  568. const totalCost = [100, 100, 100, 100]
  569. const myColor = ['#f31afd', '#316bf5', '#dd0507', '#1d3184',];
  570. const option = {
  571. grid: {
  572. left: '160',
  573. right: '100'
  574. },
  575. xAxis: {
  576. type: 'value',
  577. show: true,
  578. axisLine: {
  579. lineStyle: {
  580. color: '#000642',
  581. },
  582. },
  583. // 不显示刻度线
  584. axisTick: {
  585. show: false,
  586. },
  587. splitLine: {// 网格线为虚线
  588. show: false,
  589. },
  590. axisLabel: {
  591. interval: 0,
  592. color: '#ffffff',
  593. fontSize: 14
  594. },
  595. },
  596. yAxis: {
  597. type: 'category',
  598. axisLabel: {
  599. margin: 30,
  600. show: true,
  601. color: '#ffffff',
  602. fontSize: 14
  603. },
  604. axisTick: {
  605. show: false,
  606. },
  607. axisLine: {
  608. show: false,
  609. },
  610. data: yData
  611. },
  612. series: [
  613. {
  614. type: 'bar',
  615. barGap: '-65%',
  616. barWidth: '30%',
  617. itemStyle: {
  618. normal: {
  619. borderColor: '#0c1b4b',
  620. borderWidth: 2,
  621. barBorderRadius: 15,
  622. color: 'rgba(102, 102, 102,0)'
  623. },
  624. },
  625. z: 1,
  626. data: totalCost,
  627. },
  628. {
  629. name: "数量",
  630. type: 'bar',
  631. barGap: '-85%',
  632. barWidth: '21%',
  633. itemStyle: {
  634. normal: {
  635. barBorderRadius: 16,
  636. color: (params) => {
  637. var num = myColor.length;
  638. return {
  639. type: "linear",
  640. x: 0,
  641. y: 0,
  642. x2: 1,
  643. y2: 1,
  644. colorStops: [
  645. {
  646. offset: 1,
  647. color: "#52afe6",
  648. },
  649. {
  650. offset: 0,
  651. color: myColor[params.dataIndex % num],
  652. },
  653. ],
  654. };
  655. },
  656. }
  657. },
  658. max: 1,
  659. label: {
  660. normal: {
  661. show: true,
  662. position: 'inside',
  663. formatter: '{c}',
  664. color: '#ffffff',
  665. offset: [0, 2],
  666. }
  667. },
  668. labelLine: {
  669. show: true,
  670. },
  671. z: 2,
  672. data: xData,
  673. }]
  674. }
  675. return option
  676. }
  677. // 绘制左下角模检具数量饼图
  678. const drawCountChart = (dieCountChart, data) => {
  679. let value = 0
  680. const option2 = {
  681. title: {
  682. text: "{a|" + "总数" + "\n " + value + "}{c|}",
  683. top: "44%",
  684. textAlign: "center",
  685. left: "49%",
  686. textStyle: {
  687. color: "#00baff",
  688. fontSize: 22,
  689. fontWeight: "400",
  690. rich: {
  691. a: {
  692. fontSize: 24,
  693. color: "#00baff",
  694. fontWeight: "600",
  695. },
  696. c: {
  697. fontSize: 30,
  698. color: "#00baff",
  699. padding: [6, 4],
  700. },
  701. },
  702. },
  703. },
  704. tooltip: {
  705. trigger: "item",
  706. },
  707. series: [
  708. // 最内层的装饰圆(内一)
  709. {
  710. type: "pie",
  711. name: "装饰内圆",
  712. radius: ["20%", "20.5%"],
  713. hoverAnimation: false, //鼠标悬浮放大
  714. clockWise: false, //是否顺时针
  715. itemStyle: {
  716. normal: {
  717. color: "#87CEFA ",
  718. },
  719. },
  720. label: {
  721. show: false,
  722. },
  723. tooltip: {
  724. show: false,
  725. },
  726. data: [{ value: 0, name: 'smallPie' }],
  727. },
  728. // 真正显示数据的圆(内二)
  729. {
  730. type: "pie",
  731. name: "模检具数量",
  732. radius: ["23%", "28%"],
  733. avoidLabelOverlap: false,
  734. hoverAnimation: true,
  735. minAngle: 26,
  736. color: ["#50aee4", "#f90c29", "#2f67f6", "#0d2983", '#7979f7'],
  737. label: {
  738. normal: {
  739. show: true,
  740. formatter: "{b} {c}",
  741. fontSize: 14,
  742. fontWeight: 600,
  743. color: "#ffffff",
  744. },
  745. },
  746. // 折线样式
  747. labelLine: {
  748. normal: {
  749. show: true,
  750. length: 20,
  751. length2: 50,
  752. minTurnAngle: 150,
  753. lineStyle: {
  754. width: 2,
  755. },
  756. },
  757. },
  758. // 圆环样式
  759. itemStyle: {
  760. normal: {
  761. shadowBlur: 10,
  762. shadowColor: "#00ffff",
  763. },
  764. },
  765. // 高亮状态的扇区和标签样式
  766. emphasis: {
  767. label: {
  768. show: true,
  769. fontSize: 16,
  770. fontWeight: "bold",
  771. },
  772. },
  773. data,
  774. },
  775. // 自动转圈虚线圆(内三)
  776. {
  777. type: "pie",
  778. name: "3",
  779. silent: false,
  780. radius: ["30%", "31%"],
  781. hoverAnimation: false,
  782. label: {
  783. normal: {
  784. show: false,
  785. },
  786. },
  787. labelLine: {
  788. normal: {
  789. show: false,
  790. },
  791. },
  792. data: _pie3(),
  793. },
  794. // 两个浅颜色的装饰圆
  795. {
  796. type: "pie",
  797. name: "4",
  798. silent: false,
  799. radius: ["37%", "38%"],
  800. color: "rgba(88,142,197,0.4) ",
  801. hoverAnimation: false,
  802. label: {
  803. normal: {
  804. show: false,
  805. },
  806. },
  807. labelLine: {
  808. normal: {
  809. show: false,
  810. },
  811. },
  812. data: [{ value: 0, name: 'midPie' }, { value: 10, name: 'midPie2' }],
  813. },
  814. // 自动转圈的两个大圆弧(外四)
  815. {
  816. type: "pie",
  817. name: "5",
  818. silent: false,
  819. radius: ["38%", "40%"],
  820. // startAngle: 75,
  821. hoverAnimation: false,
  822. label: {
  823. normal: {
  824. show: false,
  825. },
  826. },
  827. labelLine: {
  828. normal: {
  829. show: false,
  830. },
  831. },
  832. data: _pie5(),
  833. },
  834. // 最外层的三个自动转圈的小圆弧(外二)
  835. {
  836. type: "pie",
  837. name: "6",
  838. silent: false,
  839. radius: ["42%", "43%"],
  840. // startAngle: 75,
  841. hoverAnimation: false,
  842. label: {
  843. normal: {
  844. show: false,
  845. },
  846. },
  847. labelLine: {
  848. normal: {
  849. show: false,
  850. },
  851. },
  852. data: _pie6(),
  853. },
  854. // 最大圆浅色(外一)
  855. {
  856. type: "pie",
  857. name: "7",
  858. silent: false,
  859. radius: ["45%", "47%"],
  860. color: "rgba(88,142,197,0.4) ",
  861. hoverAnimation: false,
  862. label: {
  863. normal: {
  864. show: false,
  865. },
  866. },
  867. labelLine: {
  868. normal: {
  869. show: false,
  870. },
  871. },
  872. data: [{ value: 0, name: 'bigPie' }],
  873. },
  874. ],
  875. };
  876. function _pie3() {
  877. let dataArr = [];
  878. for (var i = 0; i < 149; i++) {
  879. if (i % 2 === 0) {
  880. dataArr.push({
  881. value: 1, //黑色间隔
  882. name: "aaa",
  883. itemStyle: {
  884. normal: {
  885. color: "rgba(88,142,197,0)",
  886. borderWidth: 0,
  887. borderColor: "rgba(0,0,0,0)",
  888. },
  889. },
  890. });
  891. } else {
  892. dataArr.push({
  893. value: 1,
  894. name: "ooo",
  895. itemStyle: {
  896. normal: {
  897. color: "#87CEFA ",
  898. borderWidth: 0,
  899. borderColor: "rgba(0,0,0,0)",
  900. },
  901. },
  902. });
  903. }
  904. }
  905. dataArr.push({
  906. value: 50,
  907. itemStyle: {
  908. normal: {
  909. color: "#87CEFA",
  910. borderWidth: 0,
  911. borderColor: "rgba(0,0,0,0)",
  912. },
  913. },
  914. });
  915. return dataArr;
  916. }
  917. function _pie5() {
  918. let dataArr = [];
  919. // for (var i = 0; i < 2; i++) {
  920. dataArr.push(
  921. {
  922. value: 15, //黑色间隔
  923. itemStyle: {
  924. normal: {
  925. color: "rgba(88,142,197,0)",
  926. borderWidth: 0,
  927. borderColor: "rgba(0,0,0,0)",
  928. },
  929. },
  930. },
  931. {
  932. value: 20,
  933. itemStyle: {
  934. normal: {
  935. color: "#87CEFA",
  936. borderWidth: 0,
  937. borderColor: "rgba(0,0,0,0)",
  938. },
  939. },
  940. },
  941. {
  942. value: 50,
  943. itemStyle: {
  944. normal: {
  945. color: "rgba(88,142,197,0)",
  946. borderWidth: 0,
  947. borderColor: "rgba(0,0,0,0)",
  948. },
  949. },
  950. },
  951. {
  952. value: 20,
  953. itemStyle: {
  954. normal: {
  955. color: "#87CEFA",
  956. borderWidth: 0,
  957. borderColor: "rgba(0,0,0,0)",
  958. },
  959. },
  960. }
  961. );
  962. return dataArr;
  963. }
  964. function _pie6() {
  965. let dataArr = [];
  966. for (var i = 0; i < 1; i++) {
  967. dataArr.push(
  968. {
  969. value: 3,
  970. itemStyle: {
  971. normal: {
  972. color: "#87CEFA",
  973. borderWidth: 0,
  974. borderColor: "rgba(0,0,0,0)",
  975. },
  976. },
  977. },
  978. {
  979. value: 1, //黑色间隔
  980. itemStyle: {
  981. normal: {
  982. color: "rgba(88,142,197,0)",
  983. borderWidth: 0,
  984. borderColor: "rgba(0,0,0,0)",
  985. },
  986. },
  987. },
  988. {
  989. value: 5,
  990. itemStyle: {
  991. normal: {
  992. color: "#87CEFA",
  993. borderWidth: 0,
  994. borderColor: "rgba(0,0,0,0)",
  995. },
  996. },
  997. },
  998. {
  999. value: 2,
  1000. itemStyle: {
  1001. normal: {
  1002. color: "rgba(88,142,197,0)",
  1003. borderWidth: 0,
  1004. borderColor: "rgba(0,0,0,0)",
  1005. },
  1006. },
  1007. },
  1008. {
  1009. value: 10,
  1010. itemStyle: {
  1011. normal: {
  1012. color: "#87CEFA",
  1013. borderWidth: 0,
  1014. borderColor: "rgba(0,0,0,0)",
  1015. },
  1016. },
  1017. },
  1018. {
  1019. value: 150,
  1020. itemStyle: {
  1021. normal: {
  1022. color: "rgba(88,142,197,0)",
  1023. borderWidth: 0,
  1024. borderColor: "rgba(0,0,0,0)",
  1025. },
  1026. },
  1027. }
  1028. );
  1029. }
  1030. return dataArr;
  1031. }
  1032. return option2
  1033. }
  1034. // 初始化图表
  1035. const initChart = (chart, chartOption) => {
  1036. chart && chart.resize();
  1037. chart && chart.clear(); // 清除上次的数据
  1038. chart && chart.setOption(chartOption, true); // 参数配置
  1039. }