import { AutoChart, BackEndChartType, getChartType } from '@/components/chart'; import { Datum } from '@antv/ava'; import { useMemo } from 'react'; interface Props { data: { data: { data: Datum[]; describe: string; title: string; type: BackEndChartType; sql: string; }[]; title: string | null; display_strategy: string; chart_count: number; }; } const chartLayout = [[2], [1, 2], [1, 3], [2, 1, 2], [2, 1, 3], [3, 1, 3], [3, 2, 3]]; function VisDashboard({ data }: Props) { const charts = useMemo(() => { if (data.chart_count > 1) { const layout = chartLayout[data.chart_count - 2]; let prevIndex = 0; return layout.map(item => { const items = data.data.slice(prevIndex, prevIndex + item); prevIndex = item; return items; }); } return [data.data]; }, [data.data, data.chart_count]); return (