chart.js 33 KB

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