import { useMemo } from 'react' import { cn, type ChartConfig as ChartSeriesConfig } from 'ui' import { Chart, ChartBar, ChartCard, ChartContent, ChartLine } from 'ui-patterns/Chart' import { type QueryResult } from '../types' import NoDataPlaceholder from '@/components/ui/Charts/NoDataPlaceholder' import { computeYAxisWidth, formatLogTick, formatYAxisTick, getCumulativeResults, } from '@/components/ui/QueryBlock/QueryBlock.utils' import { type ChartConfig } from '@/data/content/notebooks/notebook-schema' interface QueryResultChartProps { chart?: ChartConfig result?: QueryResult } const Y_SERIES_COLORS = ['var(--primary-bright)', 'var(--chart-2)', 'var(--chart-3)'] const toChartValue = (value: unknown): string | number => { if (typeof value === 'number' || typeof value === 'string') return value if (value === null || value === undefined) return '' return String(value) } /** * Y series are keyed by position rather than by the column name they came from. * * `ChartContainer` writes every config key into a `