对比新文件 |
| | |
| | | export const timeDataOptionToContent = (opt) => { |
| | | |
| | | const headerList = [opt.xAxis[0]].concat(opt.yAxis).map((item) => `<td>${item.name}</td>`).join(''); |
| | | const title = opt.title?.[0]?.text ?? ''; |
| | | let table = '<div style="border:1px solid black"><h3>'+title+'</h3><table style="width:100%;text-align:center"><tbody><tr>' + headerList + '</tr>'; |
| | | const timeData = new Set(); |
| | | const dataMap = opt.series.map((item) => { |
| | | for (const subItem of item.data) { |
| | | timeData.add(subItem[0]); |
| | | } |
| | | return new Map(item.data); |
| | | }); |
| | | const bodyList = Array.from(timeData) |
| | | .toSorted((a, b) => { |
| | | return (a as any).localeCompare(b); |
| | | }) |
| | | .map((item) => { |
| | | |
| | | return `<tr><td>${item}</td>${dataMap.map((itemMap) => `<td>${itemMap.get(item) ?? ''}</td>`)}</tr>`; |
| | | }).join(''); |
| | | table += bodyList; |
| | | |
| | | table += '</tbody></table></div>'; |
| | | return table; |
| | | }; |
| | |
| | | import { ChartTypeEnum, chartTypeMapEchart, chartTypeMapName } from '../types'; |
| | | import type { RecordSetValues } from '/@/api/ai/chat'; |
| | | import { dateRegex } from '/@/utils/toolsValidate'; |
| | | import { timeDataOptionToContent } from '../common'; |
| | | const activeName = ref('first'); |
| | | const chartRef = ref<HTMLDivElement>(null); |
| | | const selectChartType = ref<ChartTypeEnum>(ChartTypeEnum.Line); |
| | |
| | | }, |
| | | dataView: { |
| | | readOnly: true, |
| | | optionToContent: timeDataOptionToContent, |
| | | |
| | | }, |
| | | saveAsImage: {}, |
| | | }, |
| | |
| | | import { computed, onMounted, ref } from 'vue'; |
| | | import { ChartTypeEnum, chartTypeMapEchart, chartTypeMapName } from '../types'; |
| | | import { axisLabelFormatter } from '/@/utils/chart'; |
| | | import { timeDataOptionToContent } from '../common'; |
| | | |
| | | const props = defineProps(['data']); |
| | | |
| | |
| | | refList = [chartRef.value as unknown as HTMLDivElement]; |
| | | } |
| | | } |
| | | |
| | | return refList; |
| | | }); |
| | | |
| | |
| | | }, |
| | | dataView: { |
| | | readOnly: true, |
| | | optionToContent: timeDataOptionToContent, |
| | | }, |
| | | saveAsImage: {}, |
| | | }, |