Ver código fonte

数据管理环比分析折线图优化x轴取值

ming 3 anos atrás
pai
commit
4d78254aae
1 arquivos alterados com 30 adições e 13 exclusões
  1. 30 13
      src/views/dataManage/chainAnalysis/ehcarts/index.vue

+ 30 - 13
src/views/dataManage/chainAnalysis/ehcarts/index.vue

@@ -1,8 +1,8 @@
 <template>
   <div shadow="never" class="homeBoxCard" v-loading="loading">
-    <br>
+    <br />
     <div class="height300" ref="chainChartRef" />
-     <br>
+    <br />
   </div>
 </template>
 <script>
@@ -17,7 +17,7 @@ export default defineComponent({
 
   setup(props) {
     const chainChartRef = ref(null)
-    const resultListDate=ref([])
+    const resultListDate = ref([])
 
     // 读取数据 func
     const loading = ref(true)
@@ -25,12 +25,22 @@ export default defineComponent({
       loading.value = false
       var aa = props.echartsDataOne.listDate
       var bb = props.echartsDataOne.listDate2
-       console.log(aa)
+      console.log(aa)
       console.log(bb)
-     
-      resultListDate.value = aa.map(function (index, item) {
-        return index +' / '+ bb[item]
-      })
+      if (aa.length > bb.length) {
+        resultListDate.value = aa.map(function (index, item) {
+          return index + ' / ' + (bb[item] ? bb[item] : '')
+        })
+      }else{
+        resultListDate.value = bb.map(function (index, item) {
+          return index + ' / ' + (aa[item] ? aa[item] : '')
+        })
+
+      }
+      
+
+      console.log('resultListDate.value')
+      console.log(resultListDate.value)
     }
     function echarts2() {
       let myChart = echarts.init(chainChartRef.value)
@@ -62,11 +72,16 @@ export default defineComponent({
         },
         toolbox: {
           show: true,
-           feature: {
+          feature: {
             // dataView: { show: true, readOnly: false },
             // magicType: { show: true, type: ["line", "bar"] },
             // restore: { show: true },
-            saveAsImage: { show: true, color: 'black',title:'',name:'图表下载' },
+            saveAsImage: {
+              show: true,
+              color: 'black',
+              title: '',
+              name: '图表下载',
+            },
           },
           iconStyle: {
             borderColor: '#666',
@@ -85,7 +100,10 @@ export default defineComponent({
           axisTick: {
             show: true, //去除刻度线
           },
-      //  axisLabel:false,
+          // showMinLabel: true,//显示最小值
+            showMaxLabel: true,//显示最大值
+
+          //  axisLabel:false,
           // axisLabel: {
           //   interval:0,
           //       rotate:"-12",
@@ -157,7 +175,6 @@ export default defineComponent({
     }
 
     const writeValue = (val) => {
-   
       val
 
       getData()
@@ -186,7 +203,7 @@ export default defineComponent({
       chainChartRef,
       loading,
       echarts,
-      resultListDate
+      resultListDate,
     }
   },
 })