From 32eedf2857255cf29985ffc0cc73e75eccda39bf Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期六, 20 九月 2025 22:18:15 +0800
Subject: [PATCH] 2025.9.20 完成现场巡查基础数据产品和月度巡查简报的中间数据产品

---
 src/utils/echart-util.js |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/src/utils/echart-util.js b/src/utils/echart-util.js
index ad12e65..7f907dd 100644
--- a/src/utils/echart-util.js
+++ b/src/utils/echart-util.js
@@ -69,6 +69,79 @@
   };
 }
 
+function barChartOption() {
+  return {
+    title: {
+      text: `鏌辩姸鍥鹃粯璁ゅ悕绉癭,
+      left: 'center' // 鏍囬灞呬腑鏄剧ず
+    },
+    // 娣诲姞宸ュ叿鏍忛厤缃紝鍖呭惈涓嬭浇鍔熻兘
+    toolbox: {
+      show: true,
+      feature: {
+        saveAsImage: {
+          show: true,
+          title: '涓嬭浇鍥捐〃',
+          type: 'png',
+          pixelRatio: 2 // 鎻愰珮鍥剧墖娓呮櫚搴�
+        }
+      }
+    },
+    tooltip: {
+      trigger: 'axis', // 鏌辩姸鍥句娇鐢╝xis瑙﹀彂tooltip
+      axisPointer: {
+        type: 'shadow' // 鏄剧ず闃村奖鎸囩ず鍣�
+      },
+      formatter: '{b}: {c}' // 鏄剧ず鏍煎紡锛氬悕绉�: 鏁伴噺
+    },
+    legend: {
+      show: true,
+      orient: 'horizontal',
+      bottom: '0%', // 鍥句緥搴曢儴姘村钩鎺掑垪
+    },
+    grid: {
+      // left: '3%',
+      // right: '4%',
+      bottom: '10%',
+      top: '15%',
+      containLabel: true
+    },
+    xAxis: {
+      name: '鍧愭爣杞�',
+      type: 'category',
+      data: ['sample1', 'sample2', 'sample3'], // X杞存暟鎹�
+      axisTick: {
+        alignWithLabel: true
+      },
+      axisLabel: {
+        rotate: 45,
+      }
+    },
+    yAxis: {
+      type: 'value',
+      name: '鏁伴噺', // Y杞村悕绉�
+      axisLine: {
+        show: true
+      },
+      axisLabel: {
+        formatter: '{value}'
+      }
+    },
+    series: [
+      {
+        name: 'sample',
+        type: 'bar', // 鍥捐〃绫诲瀷鏀逛负鏌辩姸鍥�
+        data: [100, 200, 300], // 鏁版嵁鍊�
+        label: {
+          show: true,
+          position: 'top', // 鏍囩鏄剧ず鍦ㄦ煴瀛愰《閮�
+          formatter: '{c}' // 鏍囩鏍煎紡锛氭暟閲�
+        }
+      }
+    ]
+  };
+}
+
 // 閫氳繃 ECharts API 涓嬭浇鍥剧墖鐨勫嚱鏁�
 function downloadChartImage(chart, fileName) {
   if (!chart) return; // 纭繚鍥捐〃宸插垵濮嬪寲
@@ -92,4 +165,4 @@
   document.body.removeChild(link);
 }
 
-export { pieChartOption, downloadChartImage };
+export { pieChartOption, barChartOption, downloadChartImage };

--
Gitblit v1.9.3