소스 검색

[Feat 0000] 可配置首页添加改进版折线图,最小值自适应

ruienger 1 개월 전
부모
커밋
16f29a8891
2개의 변경된 파일52개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/views/vent/deviceManager/configurationTable/types.ts
  2. 51 0
      src/views/vent/home/configurable/components/detail/CustomChart.vue

+ 1 - 0
src/views/vent/deviceManager/configurationTable/types.ts

@@ -209,6 +209,7 @@ export interface ModuleDataChart extends ReadFrom {
     | 'bar_cylinder'
     | 'bar_cylinder_wide'
     | 'pie_halo'
+    | 'line_enhance'
     | 'pie_drag';
   /** 排序依据,该项应配置将配合 readFrom 使用 */
   sortBy?: string;

+ 51 - 0
src/views/vent/home/configurable/components/detail/CustomChart.vue

@@ -489,6 +489,57 @@
       };
     }
 
+    if (type === 'line_enhance') {
+      return {
+        textStyle,
+        legend: {
+          show: legend.show,
+          top: 10,
+          right: 10,
+          textStyle,
+        },
+        grid: {
+          left: 60,
+          top: 40,
+          right: 60,
+          bottom: dataZoom.length ? 70 : 30,
+        },
+        dataZoom: baseDataZoom,
+        xAxis: xAxis.map((e) => {
+          return {
+            ...e,
+            type: 'category',
+            axisLabel: {
+              width: 100,
+              overflow: 'break',
+            },
+          };
+        }),
+        yAxis: yAxis.map((e, i) => {
+          return {
+            ...e,
+            min: (value) => {
+              return parseInt(value.min * 0.8);
+            },
+            max: (value) => {
+              return parseInt(value.max * 1.2);
+            },
+            splitLine: {
+              lineStyle: {
+                opacity: i === 0 ? 0.1 : 0,
+              },
+            },
+          };
+        }),
+        series: baseSeries.map((serie) => {
+          return {
+            ...serie,
+            type: 'line',
+          };
+        }),
+      };
+    }
+
     // 平滑曲线图
     if (type === 'line_smooth') {
       return {