import type { IChart } from '../interfaces'; import type { NativeRenderer } from './nativeTypes'; /** A shelf that holds more dimensions than the chart's renderer shows. */ export interface ShelfOverflow { shelf: 'rows' | 'columns'; fields: string[]; } /** * What the chart area says in place of a chart it does not draw. * - unsupported: the worksheet renderer cannot draw the chart; `reason` says what is in the way. * - failed: a query or the drawing went wrong; `reason` is the error. * - levels: the chart has more dimensions on a shelf than its renderer shows. */ export type ChartNoticeContent = { state: 'unsupported' | 'failed'; reason: string; } | { state: 'levels'; renderer: 'vega-lite' | 'observable-plot'; shelves: ShelfOverflow[]; }; /** * Where a chart is drawn. * - dedicated: maps and tables have components of their own, whichever renderer draws ordinary charts. * - classic: Vega-Lite or Observable Plot, as the chart says. * - native: the worksheet renderer. * - blank: the worksheet renderer, with nothing on the shelves to draw yet. * - notice: nowhere. The chart area says why. */ export type ChartRoute = { to: 'dedicated'; kind: 'table' | 'map'; } | { to: 'classic'; } | { to: 'native'; } | { to: 'blank'; } | { to: 'notice'; notice: ChartNoticeContent; }; /** * Picks the component that draws a chart. The kind of chart comes first: a table or a map goes to * its own component and the chart's renderer setting is not looked at. An ordinary chart goes to * the renderer it names, Worksheet where it names none. A renderer that cannot draw the chart is * never replaced by another one; the chart area says what is wrong and the chart stays as saved. */ export declare function routeChart(chart: IChart, worksheet: NativeRenderer): ChartRoute;