| | |
| | | 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]] |
| | |
| | | }, |
| | | } 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); |
| | | }; |