From b46bc2dba51a3885a68e4c58316b41a31ea16bb2 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 14 二月 2023 13:35:03 +0800
Subject: [PATCH] 1.存货档案修改

---
 src/utils/myEcharts.js |   48 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/src/utils/myEcharts.js b/src/utils/myEcharts.js
index 473374a..ac3560d 100644
--- a/src/utils/myEcharts.js
+++ b/src/utils/myEcharts.js
@@ -350,18 +350,27 @@
 }
 
 // 缁煎悎鐪嬫澘鍥�
-export function bar02(dataArr,titlenameArr) {
-  // console.log(val)
+export function bar02(dataArr, titlenameArr) {
   // const data = [70, 60, 50, 40, 30]
   // const titlename = ['澶栬鍒掍激', '琛ㄩ潰娌规薄', '灏哄', '棰滆壊', '澶у皬']
   // const data = val.map(i => i.cont)
   // const titlename = val.map(i => i.name)
-  const data = dataArr
+  const data = dataArr.filter((item, index) => index < 5)
 
-  const titlename = titlenameArr
+  const titlename = titlenameArr.filter((item, index) => index < 5)
+
+  const length = titlename.length
+  if (titlename.length < 5) {
+    for (let i = 0; i < 5 - length; i++) {
+      titlename.push('0')
+    }
+  }
 
   const valdata = [683, 500, 400, 300, 200]
-  const myColor = ['#FF0000', '#FF5511', '#FF8800', '#FFBB00', '#FFFF00']
+  // const myColor = ['#FF0000', '#FF5511', '#FF8800', '#FFBB00', '#FFFF00']
+  // const myColor = ['#0000FF']
+  // const myColor = ['#7af5f5', '#00FFFF', '#00FFFF', '#00FFFF', '#00FFFF']
+  const myColor = ['rgba(122,245,245,1)', 'rgba(122,245,245,0.95)', 'rgba(122,245,245,0.9)', 'rgba(122,245,245,0.85)', 'rgba(122,245,245,0.8)']
   const option = {
     backgroundColor: 'transparent',
     title: {
@@ -381,8 +390,8 @@
       }
     },
     grid: {
-      left: '2%',
-      right: '2%',
+      left: '10%',
+      right: '5%',
       bottom: '0%',
       top: '10%',
       containLabel: true
@@ -405,13 +414,24 @@
           show: false
         },
         axisLabel: {
-          // color: '#d8d7d9',
-          color: '#fff',
-          fontSize: 14,
-          formatter: function(value, index) {
-            return [
-              '{lg|' + (index + 1) + '銆�   }' + '{title|' + value + '} '
-            ].join('\n')
+          // color: '#fff',
+          color: function(value, index) {
+            return value === '0' ? 'transparent' : '#fff'
+          },
+          fontSize: 18,
+          // formatter: function(value, index) {
+          //   return [
+          //     '{lg|' + (index + 1) + '銆�   }' + '{title|' + value + '} '
+          //   ].join('\n')
+          // },
+          formatter: function(params) {
+            var val = ''
+            if (params.length > 8) {
+              val = params.substr(0, 8) + '...'
+              return val
+            } else {
+              return params
+            }
           },
           rich: {
             lg: {

--
Gitblit v1.9.3