chart.js 34 KB

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