import { ChartMedia, ChartMode } from '../tokens/chart'; export type { ChartMedia, ChartMode }; export type ChartType = 'line' | 'area' | 'bar' | 'stackedBar' | 'horizontalBar' | 'pie' | 'donut' | 'scatter' | 'heatmap' | 'sankey' | 'kpi' | 'table'; export type AxisType = 'category' | 'value' | 'time' | 'log'; /** One row of the source result set. */ export type ChartRow = Record; export interface AxisConfig { id: string; type: AxisType; name?: string; position?: 'top' | 'bottom' | 'left' | 'right'; hidden?: boolean; min?: number | 'dataMin'; max?: number | 'dataMax'; } export interface SeriesConfig { id: string; name: string; fields: { x?: string; y?: string; /** Weight for sankey links and heatmap cells. */ value?: string; /** Link endpoint for sankey. */ target?: string; }; xAxisIndex?: number; yAxisIndex?: number; /** Overrides the assigned categorical slot. Use sparingly. */ color?: string; hidden?: boolean; } export interface ChartConfig { title?: string; subtitle?: string; chartType: ChartType; legend?: { show: boolean; position?: 'top' | 'bottom' | 'left' | 'right'; }; xAxes?: readonly AxisConfig[]; yAxes?: readonly AxisConfig[]; series: readonly SeriesConfig[]; /** * Overlays ECharts decal textures (hatching, dots) on every mark, giving * series identity a second encoding channel besides hue. * * Off by default. Decals are a deliberate visual trade: they help where marks * are large and few (bars, pie slices) and readers may not separate adjacent * hues, but they add noise to dense plots and change the look of every chart * in the product. That is a call for the consumer, not a default. * * Ignored for heatmaps, which encode magnitude by lightness — see * `buildOption/matrix.ts`. */ decals?: boolean; } /** Emitted by `onPointClick`, for drill-through. */ export interface ChartPoint { seriesId: string; seriesName: string; x: string | number; y: number; /** The source row this mark came from. */ row: ChartRow; } /** * Conditions the component cannot observe for itself. There is deliberately no * `'empty'` member: emptiness is derived from `data`, so a caller cannot pass * `data={[]}` alongside a contradicting state. * * Precedence: `error` > `loading` > derived-empty > rendered chart. */ export type ChartState = 'loading' | 'error';