From f052d279131a056cb82c178ae195f463caa72c33 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期日, 04 八月 2024 14:01:23 +0800 Subject: [PATCH] 新增表格展示方式 --- 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..ff5af86 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: 35, + 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