chart.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. // 近七日出入库数据折线图
  2. const drawDaysChart = () => {
  3. const option = {
  4. color: ['#23CF9C', '#578FFB'],
  5. legend: {
  6. show: true,
  7. top: '6%',
  8. itemWidth: 30, // 图例标记的图形宽度。
  9. // itemGap: 20, // 图例每项之间的间隔。
  10. itemHeight: 10, // 图例标记的图形高度。
  11. textStyle: {
  12. color: '#fff',
  13. fontSize: 14,
  14. padding: [0, 8, 0, 8]
  15. }
  16. },
  17. tooltip: {
  18. trigger: 'axis',
  19. axisPointer: {
  20. type: 'shadow',
  21. },
  22. },
  23. grid: {
  24. top: '20%',
  25. left: '4%',
  26. right: '4%',
  27. bottom: '10%',
  28. containLabel: true,
  29. },
  30. xAxis: [
  31. {
  32. type: 'category',
  33. boundaryGap: false,
  34. axisLine: {
  35. //坐标轴轴线相关设置。数学上的x轴
  36. show: true,
  37. lineStyle: {
  38. color: 'rgb(41,188,245)',
  39. },
  40. },
  41. axisLabel: {
  42. //坐标轴刻度标签的相关设置
  43. textStyle: {
  44. color: '#FFFFFF',
  45. fontSize: 12,
  46. },
  47. },
  48. splitLine: {
  49. show: false,
  50. lineStyle: {
  51. color: '#233653',
  52. },
  53. },
  54. axisTick: {
  55. show: false,
  56. },
  57. data: [],
  58. },
  59. ],
  60. yAxis: [
  61. {
  62. name: "",
  63. nameTextStyle: {
  64. color: "#fff",
  65. fontSize: 12,
  66. padding: [0, 60, 0, 0]
  67. },
  68. // minInterval: 1,
  69. type: 'value',
  70. splitLine: {
  71. show: true,
  72. lineStyle: {
  73. color: '#1160a0',
  74. type: 'dashed'
  75. },
  76. },
  77. axisLine: {
  78. show: true,
  79. lineStyle: {
  80. color: '#008de7',
  81. },
  82. },
  83. axisLabel: {
  84. show: true,
  85. textStyle: {
  86. color: '#fff',
  87. fontSize: 14
  88. }
  89. },
  90. axisTick: {
  91. show: false,
  92. },
  93. },
  94. ],
  95. series: [
  96. {
  97. name: '出库',
  98. type: 'line',
  99. smooth: true,
  100. showSymbol: false,
  101. symbol: 'circle',
  102. zlevel: 3,
  103. areaStyle: {
  104. color: {
  105. type: 'linear',
  106. x: 0,
  107. y: 0,
  108. x2: 0,
  109. y2: 1,
  110. colorStops: [ // 渐变颜色
  111. {
  112. offset: 0,
  113. color: 'rgba(36, 214, 214, 0.6)',
  114. },
  115. {
  116. offset: 1,
  117. color: 'rgba(36, 214, 214, 0)',
  118. },
  119. ],
  120. global: false,
  121. },
  122. },
  123. data: [],
  124. },
  125. {
  126. name: '入库',
  127. type: 'line',
  128. smooth: true,
  129. showSymbol: false,
  130. symbol: 'circle',
  131. zlevel: 3,
  132. areaStyle: {
  133. color: {
  134. type: 'linear',
  135. x: 0,
  136. y: 0,
  137. x2: 0,
  138. y2: 1,
  139. colorStops: [ // 渐变颜色
  140. {
  141. offset: 0,
  142. color: 'rgba(61, 132, 247, 0.6)',
  143. },
  144. {
  145. offset: 1,
  146. color: 'rgba(61, 132, 247, 0)',
  147. },
  148. ],
  149. global: false,
  150. },
  151. },
  152. data: [],
  153. },
  154. ],
  155. }
  156. return option
  157. }
  158. // 今日出入库按货位分柱状图
  159. const drawPositionChart = () => {
  160. const option = {
  161. xAxis: [//x轴
  162. {
  163. type: 'category',//坐标轴类型 离散
  164. data: ['工装', '设备', '成品', '立体', '地面'],//数据
  165. axisTick: false,//是否显示刻度
  166. axisLine: {//坐标轴样式
  167. show: true,//是否显示
  168. lineStyle: {
  169. color: 'rgb(41,188,245)',
  170. },
  171. },
  172. axisLabel: {
  173. color: "#DEDEDE"
  174. }
  175. },
  176. ],
  177. yAxis: [//y轴
  178. {
  179. name: '',//名称
  180. type: 'value',//连续类型
  181. axisLine: {//坐标轴样式
  182. show: false, //不显示
  183. },
  184. splitLine: {
  185. show: true,
  186. lineStyle: {
  187. color: '#1160a0',
  188. type: 'dashed'
  189. },
  190. },
  191. axisLine: {
  192. show: true,
  193. lineStyle: {
  194. color: '#008de7',
  195. },
  196. },
  197. },
  198. ],
  199. series: [//系统列表
  200. {
  201. name: '出库',//名称
  202. type: 'bar',//类型
  203. barWidth: 11,//宽度
  204. z: 2,
  205. itemStyle: {
  206. color: {//渐变色
  207. x: 0,
  208. y: 0,
  209. x2: 0,
  210. y2: 1,
  211. type: 'linear',
  212. global: false,
  213. colorStops: [
  214. {
  215. offset: 0,
  216. color: 'rgba(6, 244, 231)',
  217. },
  218. {
  219. offset: 1,
  220. color: 'rgba(6, 244, 231,0)',
  221. },
  222. ],
  223. },
  224. },
  225. data: [],//数值
  226. },
  227. {
  228. name: '入库',
  229. type: 'bar',
  230. barWidth: 11,
  231. z: 1,
  232. itemStyle: {
  233. color: {
  234. x: 0,
  235. y: 0,
  236. x2: 0,
  237. y2: 1,
  238. type: 'linear',
  239. global: false,
  240. colorStops: [
  241. {
  242. offset: 0,
  243. color: 'rgba(3, 181, 243)',
  244. },
  245. {
  246. offset: 1,
  247. color: 'rgba(2, 190, 251,0)',
  248. },
  249. ],
  250. },
  251. },
  252. data: [],
  253. },
  254. ],
  255. legend: {
  256. show: true,
  257. top: '1%',
  258. itemWidth: 30, // 图例标记的图形宽度。
  259. // itemGap: 20, // 图例每项之间的间隔。
  260. itemHeight: 10, // 图例标记的图形高度。
  261. textStyle: {
  262. color: '#fff',
  263. fontSize: 14,
  264. padding: [0, 8, 0, 8]
  265. }
  266. },
  267. }
  268. return option
  269. }
  270. // 年领用统计柱折图
  271. const drawYearChart = () => {
  272. const option = {
  273. color: ['#3398DB'],
  274. legend: {
  275. show: true,
  276. top: '8%',
  277. itemWidth: 30, // 图例标记的图形宽度。
  278. // itemGap: 20, // 图例每项之间的间隔。
  279. itemHeight: 10, // 图例标记的图形高度。
  280. textStyle: {
  281. color: '#fff',
  282. fontSize: 14,
  283. padding: [0, 8, 0, 8]
  284. }
  285. },
  286. tooltip: {
  287. trigger: 'axis',
  288. axisPointer: {
  289. // 坐标轴指示器,坐标轴触发有效
  290. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  291. }
  292. },
  293. grid: {
  294. left: '3%',
  295. right: '4%',
  296. bottom: '3%',
  297. containLabel: true
  298. },
  299. xAxis: [
  300. {
  301. type: 'category',
  302. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  303. axisTick: {
  304. alignWithLabel: true
  305. },
  306. //x底部文字
  307. axisLabel: {
  308. textStyle: {
  309. color: '#fff'
  310. }
  311. },
  312. axisLine: {//坐标轴样式
  313. show: true,//是否显示
  314. lineStyle: {
  315. color: 'rgb(41,188,245)',
  316. },
  317. },
  318. }
  319. ],
  320. yAxis: [
  321. {
  322. type: 'value',
  323. //y右侧文字
  324. axisLabel: {
  325. textStyle: {
  326. color: '#fff'
  327. }
  328. },
  329. // y轴的分割线
  330. splitLine: {
  331. show: true,
  332. lineStyle: {
  333. color: '#1160a0',
  334. type: 'dashed'
  335. },
  336. },
  337. axisLine: {
  338. show: true,
  339. lineStyle: {
  340. color: '#008de7',
  341. },
  342. },
  343. }
  344. ],
  345. series: [
  346. {
  347. name: '总领用',
  348. type: 'line',
  349. smooth: true,
  350. showSymbol: false,
  351. tooltip: {
  352. trigger: 'axis',
  353. axisPointer: {
  354. // 坐标轴指示器,坐标轴触发有效
  355. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  356. }
  357. },
  358. areaStyle: {
  359. opacity: 0.2,
  360. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  361. {
  362. offset: 0,
  363. color: '#36d9ab'
  364. },
  365. {
  366. offset: 1,
  367. color: '#02137c'
  368. }
  369. ])
  370. },
  371. data: []
  372. },
  373. {
  374. name: '设备领用',
  375. type: 'bar',
  376. barWidth: '15',
  377. itemStyle: {
  378. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  379. { offset: 0, color: 'rgba(68,182,131, 0.9)' },
  380. { offset: 0.5, color: 'rgba(92,218,248, 0.5)' },
  381. ])
  382. },
  383. data: []
  384. },
  385. {
  386. name: '工装领用',
  387. type: 'bar',
  388. barWidth: '15',
  389. itemStyle: {
  390. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  391. { offset: 0, color: '#6a8ffd' },
  392. { offset: 1, color: '#56cbfe' }
  393. ])
  394. },
  395. data: []
  396. },
  397. ]
  398. }
  399. return option
  400. }
  401. // 今日出入库数据按类型分
  402. const drawTypeChart = () => {
  403. var colorList = ['#7ed4ac', '#fe9c3a', '#ebd571', '#eb7c6f', '#0bb4d7', '#8fcde5', '#00c973'];
  404. var seriesData = [
  405. {
  406. name: '工装入库数', //模块名称
  407. value: '0', //占比
  408. },
  409. {
  410. name: '工装出库数', //模块名称
  411. value: '0', //占比
  412. },
  413. {
  414. name: '设备入库数', //模块名称
  415. value: '0', //占比
  416. },
  417. {
  418. name: '设备出库数', //模块名称
  419. value: '0', //占比
  420. },
  421. {
  422. name: '成品入库数', //模块名称
  423. value: '0', //占比
  424. },
  425. {
  426. name: '成品出库数', //模块名称
  427. value: '0', //占比
  428. },
  429. ];
  430. const option = {
  431. color: colorList,
  432. title: [
  433. {
  434. text: '今日出\n入库数据',
  435. left: 'center',
  436. top: 'center',
  437. textStyle: {
  438. color: '#fff',
  439. fontSize: 16,
  440. fontWeight: 'bold'
  441. }
  442. }
  443. ],
  444. tooltip: {
  445. trigger: 'item',
  446. borderColor: 'rgba(255,255,255,.3)',
  447. backgroundColor: 'rgba(13,5,30,.6)',
  448. borderWidth: 1,
  449. padding: 5,
  450. textStyle: {
  451. fontSize: 14,
  452. color: '#fff',
  453. },
  454. },
  455. series: [
  456. {
  457. name: '类型',
  458. type: 'pie',
  459. radius: ['25%', '45%'],
  460. center: ['50%', '50%'],
  461. data: seriesData,
  462. hoverAnimation: true,
  463. itemStyle: {
  464. normal: {
  465. borderColor: colorList,
  466. borderWidth: 0,
  467. },
  468. },
  469. labelLine: {
  470. normal: {
  471. lineStyle: {
  472. color: '#e6e6e6',
  473. },
  474. },
  475. },
  476. label: {
  477. normal: {
  478. show: true,
  479. position: 'outside',
  480. formatter: function (params) {
  481. const color = colorList[params.dataIndex % colorList.length];
  482. return `{name|${params.name}}\n{value${params.dataIndex}|${params.value}件}`;
  483. },
  484. rich: {
  485. name: {
  486. fontSize: 14,
  487. fontWeight: 'bold',
  488. padding: [0, 0, 5, 0],
  489. color: '#fff',
  490. align: 'center'
  491. },
  492. value0: {
  493. fontSize: 16,
  494. fontWeight: 'bold',
  495. color: colorList[0],
  496. align: 'center',
  497. padding: [5, 0, 0, 0]
  498. },
  499. value1: {
  500. fontSize: 16,
  501. fontWeight: 'bold',
  502. color: colorList[1],
  503. align: 'center',
  504. padding: [5, 0, 0, 0]
  505. },
  506. value2: {
  507. fontSize: 16,
  508. fontWeight: 'bold',
  509. color: colorList[2],
  510. align: 'center',
  511. padding: [5, 0, 0, 0]
  512. },
  513. value3: {
  514. fontSize: 16,
  515. fontWeight: 'bold',
  516. color: colorList[3],
  517. align: 'center',
  518. padding: [5, 0, 0, 0]
  519. },
  520. value4: {
  521. fontSize: 16,
  522. fontWeight: 'bold',
  523. color: colorList[4],
  524. align: 'center',
  525. padding: [5, 0, 0, 0]
  526. },
  527. value5: {
  528. fontSize: 16,
  529. fontWeight: 'bold',
  530. color: colorList[5],
  531. align: 'center',
  532. padding: [5, 0, 0, 0]
  533. }
  534. },
  535. },
  536. },
  537. },
  538. ],
  539. };
  540. return option
  541. }
  542. // Top5
  543. const drawTopChart = () => {
  544. var yData = [
  545. '',
  546. '',
  547. '',
  548. '',
  549. '',
  550. ];
  551. var data = [0, 0, 0, 0, 0];
  552. const option = {
  553. tooltip: {
  554. trigger: 'axis',
  555. axisPointer: {
  556. type: 'none',
  557. },
  558. formatter: function (params) {
  559. if (!params || !params.length || !params[0] || !params[0].name) return '';
  560. return params[0].name + ' : ' + params[0].value;
  561. },
  562. },
  563. xAxis: {
  564. show: false,
  565. type: 'value',
  566. },
  567. grid: {
  568. right: '12%',
  569. left: '30%',
  570. top: '14%',
  571. bottom: '20%',
  572. },
  573. yAxis: [
  574. {
  575. name: '',
  576. type: 'category',
  577. inverse: true,
  578. boundaryGap: false,
  579. offset: 100,
  580. axisLabel: {
  581. show: true,
  582. align: 'left',
  583. textStyle: {
  584. color: '#fff',
  585. fontSize: '14',
  586. },
  587. formatter: function (value, index) {
  588. if (!value) return '';
  589. // 对value进行长度限制,小于5个字符完整显示,否则截取前5个字符并添加省略号
  590. var formattedValue = value.length < 5 ? value : value.substring(0, 5) + '...';
  591. var num = '';
  592. var str = '';
  593. num = index + 1;
  594. if (index === 0) {
  595. str = '{no1|' + '} {num1|' + num + '} {title1| ' + formattedValue + '}';
  596. } else if (index === 1) {
  597. str = '{no2|' + '} {num2|' + num + '} {title2| ' + formattedValue + '}';
  598. } else if (index === 2) {
  599. str = '{no3|' + '} {num3|' + num + '} {title3| ' + formattedValue + '}';
  600. } else {
  601. str = ' {num|' + num + '} {title| ' + formattedValue + '}';
  602. }
  603. return str;
  604. },
  605. rich: {
  606. num: {
  607. color: '#387ec1',
  608. width: 10,
  609. height: 10,
  610. fontSize: 14,
  611. padding: [6, 5, 3, 5],
  612. align: 'center',
  613. shadowColor: '#3374ba',
  614. borderColor: '#3374ba',
  615. borderWidth: 1,
  616. },
  617. num1: {
  618. color: '#51aff8',
  619. backgroundColor: '#112b67',
  620. width: 10,
  621. height: 10,
  622. fontSize: 14,
  623. padding: [7, 5, 3, 5],
  624. align: 'center',
  625. shadowColor: '#4db2ff',
  626. borderColor: '#4db2ff',
  627. borderWidth: 1,
  628. },
  629. num2: {
  630. color: '#51aff8',
  631. backgroundColor: '#112b67',
  632. width: 10,
  633. height: 10,
  634. fontSize: 14,
  635. padding: [7, 5, 3, 5],
  636. align: 'center',
  637. shadowColor: '#4db2ff',
  638. borderColor: '#4db2ff',
  639. borderWidth: 1,
  640. },
  641. num3: {
  642. color: '#51aff8',
  643. backgroundColor: '#112b67',
  644. width: 10,
  645. height: 10,
  646. fontSize: 14,
  647. padding: [7, 5, 3, 5],
  648. align: 'center',
  649. shadowColor: '#4db2ff',
  650. borderColor: '#4db2ff',
  651. borderWidth: 1,
  652. },
  653. },
  654. },
  655. splitLine: {
  656. show: false,
  657. },
  658. axisTick: {
  659. show: false,
  660. },
  661. axisLine: {
  662. show: false,
  663. },
  664. data: yData,
  665. },
  666. ],
  667. series: [
  668. {
  669. name: '值',
  670. type: 'bar',
  671. zlevel: 1,
  672. barCategoryGap: '20%',
  673. itemStyle: {
  674. normal: {
  675. // barBorderRadius: 30,
  676. color: {
  677. type: 'linear',
  678. x: 0,
  679. y: 0,
  680. x2: 1,
  681. y2: 0,
  682. colorStops: [
  683. { offset: 0, color: '#2770a2' },
  684. { offset: 1, color: '#00d0ff' },
  685. ],
  686. global: false,
  687. },
  688. },
  689. },
  690. label: {
  691. normal: {
  692. show: true,
  693. position: "right",
  694. valueAnimation: true,
  695. offset: [5, -2],
  696. textStyle: {
  697. color: "#F5F5F5",
  698. fontSize: 13,
  699. },
  700. formatter: function (params) {
  701. if (!params || !params.name || params.value === 0 || params.value === '0') return '';
  702. return params.value;
  703. }
  704. },
  705. },
  706. barWidth: 22,
  707. data: data,
  708. },
  709. ],
  710. };
  711. return option
  712. }
  713. // 工装设备检验图表
  714. const drawCheckoutChart = () => {
  715. const option = {
  716. color: ['#e8bc64', '#2c90ee'],
  717. legend: {
  718. show: true,
  719. top: '6%',
  720. itemWidth: 30, // 图例标记的图形宽度。
  721. // itemGap: 20, // 图例每项之间的间隔。
  722. itemHeight: 10, // 图例标记的图形高度。
  723. textStyle: {
  724. color: '#fff',
  725. fontSize: 14,
  726. padding: [0, 8, 0, 8]
  727. }
  728. },
  729. tooltip: {
  730. trigger: 'axis',
  731. axisPointer: {
  732. type: 'shadow',
  733. },
  734. },
  735. grid: {
  736. top: '20%',
  737. left: '4%',
  738. right: '4%',
  739. bottom: '10%',
  740. containLabel: true,
  741. },
  742. xAxis: [
  743. {
  744. type: 'category',
  745. boundaryGap: false,
  746. axisLine: {
  747. //坐标轴轴线相关设置。数学上的x轴
  748. show: true,
  749. lineStyle: {
  750. color: 'rgb(41,188,245)',
  751. },
  752. },
  753. axisLabel: {
  754. //坐标轴刻度标签的相关设置
  755. textStyle: {
  756. color: '#FFFFFF',
  757. fontSize: 12,
  758. },
  759. },
  760. splitLine: {
  761. show: false,
  762. lineStyle: {
  763. color: '#233653',
  764. },
  765. },
  766. axisTick: {
  767. show: false,
  768. },
  769. data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  770. },
  771. ],
  772. yAxis: [
  773. {
  774. name: "",
  775. nameTextStyle: {
  776. color: "#fff",
  777. fontSize: 12,
  778. padding: [0, 60, 0, 0]
  779. },
  780. // minInterval: 1,
  781. type: 'value',
  782. splitLine: {
  783. show: true,
  784. lineStyle: {
  785. color: '#1160a0',
  786. type: 'dashed'
  787. },
  788. },
  789. axisLine: {
  790. show: true,
  791. lineStyle: {
  792. color: '#008de7',
  793. },
  794. },
  795. axisLabel: {
  796. show: true,
  797. textStyle: {
  798. color: '#fff',
  799. fontSize: 14
  800. }
  801. },
  802. axisTick: {
  803. show: false,
  804. },
  805. },
  806. ],
  807. series: [
  808. {
  809. name: '工装',
  810. type: 'line',
  811. smooth: true,
  812. showSymbol: false,
  813. symbol: 'circle',
  814. zlevel: 3,
  815. areaStyle: {
  816. color: {
  817. type: 'linear',
  818. x: 0,
  819. y: 0,
  820. x2: 0,
  821. y2: 1,
  822. colorStops: [ // 渐变颜色
  823. {
  824. offset: 0,
  825. color: 'rgba(225, 188, 69)',
  826. },
  827. {
  828. offset: 1,
  829. color: 'rgba(66, 78, 65)',
  830. },
  831. ],
  832. global: false,
  833. },
  834. },
  835. data: [],
  836. },
  837. {
  838. name: '设备',
  839. type: 'line',
  840. smooth: true,
  841. showSymbol: false,
  842. symbol: 'circle',
  843. zlevel: 3,
  844. areaStyle: {
  845. color: {
  846. type: 'linear',
  847. x: 0,
  848. y: 0,
  849. x2: 0,
  850. y2: 1,
  851. colorStops: [ // 渐变颜色
  852. {
  853. offset: 0,
  854. color: 'rgba(61, 132, 247, 0.6)',
  855. },
  856. {
  857. offset: 1,
  858. color: 'rgba(61, 132, 247, 0)',
  859. },
  860. ],
  861. global: false,
  862. },
  863. },
  864. data: [],
  865. },
  866. ],
  867. }
  868. return option
  869. }
  870. // Agv年任务统计图
  871. const drawAgvYearChart = () => {
  872. const option = {
  873. xAxis: [//x轴
  874. {
  875. type: 'category',//坐标轴类型 离散
  876. data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  877. axisTick: false,//是否显示刻度
  878. axisLine: {//坐标轴样式
  879. show: true,//是否显示
  880. lineStyle: {
  881. color: 'rgb(41,188,245)',
  882. },
  883. },
  884. axisLabel: {
  885. color: "#DEDEDE"
  886. }
  887. },
  888. ],
  889. yAxis: [//y轴
  890. {
  891. name: '',//名称
  892. type: 'value',//连续类型
  893. axisLine: {//坐标轴样式
  894. show: false, //不显示
  895. },
  896. splitLine: {
  897. show: true,
  898. lineStyle: {
  899. color: '#1160a0',
  900. type: 'dashed'
  901. },
  902. },
  903. axisLine: {
  904. show: true,
  905. lineStyle: {
  906. color: '#008de7',
  907. },
  908. },
  909. },
  910. ],
  911. series: [//系统列表
  912. {
  913. name: '地面库',//名称
  914. type: 'bar',//类型
  915. barWidth: 11,//宽度
  916. z: 2,
  917. itemStyle: {
  918. color: {//渐变色
  919. x: 0,
  920. y: 0,
  921. x2: 0,
  922. y2: 1,
  923. type: 'linear',
  924. global: false,
  925. colorStops: [
  926. {
  927. offset: 0,
  928. color: '#dbcc5b',
  929. },
  930. {
  931. offset: 1,
  932. color: '#393218',
  933. },
  934. ],
  935. },
  936. },
  937. data: [],//数值
  938. },
  939. {
  940. name: '立体库',
  941. type: 'bar',
  942. barWidth: 11,
  943. z: 1,
  944. itemStyle: {
  945. color: {
  946. x: 0,
  947. y: 0,
  948. x2: 0,
  949. y2: 1,
  950. type: 'linear',
  951. global: false,
  952. colorStops: [
  953. {
  954. offset: 0,
  955. color: '#2891ed',
  956. },
  957. {
  958. offset: 1,
  959. color: '#132243',
  960. },
  961. ],
  962. },
  963. },
  964. data: [],
  965. },
  966. ],
  967. legend: {
  968. show: true,
  969. top: '1%',
  970. itemWidth: 30, // 图例标记的图形宽度。
  971. // itemGap: 20, // 图例每项之间的间隔。
  972. itemHeight: 10, // 图例标记的图形高度。
  973. textStyle: {
  974. color: '#fff',
  975. fontSize: 14,
  976. padding: [0, 8, 0, 8]
  977. }
  978. },
  979. }
  980. return option
  981. }
  982. // AGV任务执行统计
  983. const drawAgvTotalChart = () => {
  984. option = {
  985. color: ['#e1c838', '#208ff8'],
  986. tooltip: {
  987. trigger: 'item',
  988. },
  989. legend: {
  990. type: "scroll",
  991. orient: 'vertical',
  992. left: '1%',
  993. top: '15%',
  994. align: 'left',
  995. textStyle: {
  996. color: '#fff'
  997. },
  998. },
  999. series: [
  1000. {
  1001. name: '任务统计',
  1002. type: 'pie',
  1003. radius: [30, 98],
  1004. center: ['50%', '50%'],
  1005. roseType: 'area',
  1006. label: {
  1007. show: true, // 是否显示
  1008. position: 'outside', // 标签的位置
  1009. formatter: function (params) { // 标签内容格式器
  1010. return `{a|${params.name}(${params.value})}`
  1011. },
  1012. rich: { // 自定义富文本样式
  1013. a: {
  1014. padding: [10, -10, -50, -1], // 边距
  1015. fontSize: '0.16rem', // 字号
  1016. color: '#fff', // 字体颜色
  1017. },
  1018. b: {
  1019. padding: [0, -80, 55, -80], // 边距
  1020. fontSize: '0.16rem', // 字号
  1021. color: '#ffff', // 字体颜色
  1022. },
  1023. }
  1024. },
  1025. data: [
  1026. { value: 0, name: '未完成' },
  1027. { value: 0, name: '已完成' },
  1028. ],
  1029. },
  1030. ],
  1031. }
  1032. return option
  1033. }
  1034. // 初始化图表
  1035. const initChart = (chart, chartOption) => {
  1036. chart && chart.resize();
  1037. chart && chart.clear(); // 清除上次的数据
  1038. chart && chart.setOption(chartOption, true); // 参数配置
  1039. }