From e2e2f224c5d439e3128ea95ac2cd7847b66641f6 Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期日, 29 九月 2024 20:27:07 +0800
Subject: [PATCH] 1rem

---
 src/components/chat/chatComponents/common.ts |   71 +++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/components/chat/chatComponents/common.ts b/src/components/chat/chatComponents/common.ts
index 073d319..0188716 100644
--- a/src/components/chat/chatComponents/common.ts
+++ b/src/components/chat/chatComponents/common.ts
@@ -1,5 +1,8 @@
+import type * as echarts from 'echarts';
 import { buildProps } from 'element-plus/es/utils/vue/props/runtime';
+import _ from 'lodash';
 import type { ExtractPropTypes, PropType } from 'vue';
+import { axisLabelFormatter } from '/@/utils/chart';
 
 export const timeDataOptionToContent = (opt) => {
 	const headerList = [opt.xAxis[0]]
@@ -53,3 +56,71 @@
 	},
 } as const);
 export type ChatComPropsType = ExtractPropTypes<typeof chatComProps>;
+
+export const getChatChartOption = () => {
+	const option = {
+		grid: {
+			// bottom: 120,
+			// right: '15%',
+			top: 65,
+			left: 65,
+			right: 45,
+		},
+		tooltip: {
+			show: true,
+			trigger: 'axis',
+		
+		},
+		toolbox: {
+			show: true,
+			feature: {
+				dataZoom: {
+					yAxisIndex: 'none',
+				},
+
+				myBar: {
+					title: '杞寲涓烘煴鐘跺浘',
+					show: true,
+					icon: PATH_ICON.bar,
+				},
+
+				myScatter: {
+					title: '杞寲涓烘暎鐐瑰浘',
+					show: true,
+					icon: PATH_ICON.scatter,
+				},
+				myLine: {
+					title: '杞寲涓烘洸绾垮浘',
+					show: true,
+					icon: PATH_ICON.line,
+				},
+				dataView: {
+					readOnly: true,
+					optionToContent: timeDataOptionToContent,
+				},
+				saveAsImage: {},
+			},
+		},
+
+		title: {
+			left: 'center',
+			textStyle: {
+				fontSize: 14,
+			},
+		},
+		xAxis: {
+			type: 'time',
+		},
+		yAxis: {
+			type: 'value',
+			axisLabel: {
+				formatter: axisLabelFormatter,
+			},
+		},
+		dataZoom: {
+			type: 'inside',
+		},
+	} as echarts.EChartsOption;
+
+	return _.cloneDeep(option);
+};

--
Gitblit v1.9.3