From b5312ca8f8cea8218293053b1a0b5b232d321a0b Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期三, 10 十二月 2025 17:27:29 +0800
Subject: [PATCH] feat: databoard

---
 src/views/DataBoard/utils/index.ts |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 99 insertions(+), 0 deletions(-)

diff --git a/src/views/DataBoard/utils/index.ts b/src/views/DataBoard/utils/index.ts
index 8c9e572..30489d8 100644
--- a/src/views/DataBoard/utils/index.ts
+++ b/src/views/DataBoard/utils/index.ts
@@ -286,3 +286,102 @@
     })),
   } as EChartsOption);
 }
+
+type CreatDataBoardLeftLineChartOptions = {
+  data: number[];
+  xAxisData: (number | string)[];
+  name: string;
+  yAxisName: string;
+  smooth: boolean;
+  color: string;
+  opacityColor: string;
+};
+
+export function creatDataBoardLeftLineChartOptions({
+  data,
+  xAxisData,
+  name,
+  yAxisName,
+  smooth,
+  color,
+  opacityColor,
+}: CreatDataBoardLeftLineChartOptions) {
+  return _.merge({}, CommonBarChartOptions, {
+    grid: {
+      left: '15%',
+    },
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {
+        type: 'cross',
+        label: {
+          backgroundColor: '#6a7985',
+        },
+      },
+    },
+    xAxis: {
+      data: xAxisData,
+    },
+    yAxis: {
+      name: yAxisName,
+    },
+    series: [
+      {
+        name: name,
+        type: 'line',
+        data: data,
+        smooth: smooth,
+        lineStyle: {
+          width: 1,
+          color: color, // 鎶樼嚎棰滆壊
+        },
+        itemStyle: {
+          opacity: 0,
+        },
+        showSymbol: false,
+        areaStyle: {
+          color: new echarts.graphic.LinearGradient(
+            0,
+            0,
+            0,
+            1, // 娓愬彉鏂瑰悜锛�0,0锛堝彸涓婏級鈫� 0,1锛堝彸涓嬶級锛堝瀭鐩村悜涓嬶級
+            [
+              { offset: 0, color: opacityColor }, // 鎶樼嚎澶勯鑹诧紙涓嶉�忔槑锛�
+              { offset: 1, color: 'rgba(64, 158, 255, 0)' }, // X杞村棰滆壊锛堝畬鍏ㄩ�忔槑锛�
+            ]
+          ),
+        },
+      },
+    ],
+  } as EChartsOption);
+}
+
+type CreatDataBoardLeftBarChartOptions = {
+  data: number[];
+  xAxisData: (number | string)[];
+};
+
+export function creatDataBoardLeftBarChartOptions({
+  data,
+  xAxisData,
+}: CreatDataBoardLeftBarChartOptions) {
+  return _.merge({}, CommonBarChartOptions, {
+    xAxis: {
+      data: xAxisData,
+    },
+    yAxis: {
+      name: '鍗曚綅/涓囧厓',
+    },
+    series: [
+      {
+        name: '鏈湀',
+        type: 'bar',
+        data: data,
+        itemStyle: {
+          color: '#19DAB0',
+        },
+        barWidth: '15%',
+      },
+    ],
+  } as EChartsOption);
+}

--
Gitblit v1.9.1