import { Table } from "apache-arrow"; //#region src/react/charts/types.d.ts /** Supported data formats for analytics queries */ type DataFormat = "json" | "arrow" | "auto"; /** Chart orientation */ type Orientation = "vertical" | "horizontal"; /** Supported chart types */ type ChartType = "bar" | "line" | "area" | "pie" | "donut" | "scatter" | "radar" | "heatmap"; /** Data that can be passed to unified charts */ type ChartData = Table | Record[]; /** Color palette types for different visualization needs */ type ChartColorPalette = "categorical" | "sequential" | "diverging"; /** Resolved colors for the chart UI — axis text, titles, grid lines, and tooltip. */ interface ChartUITokens { /** Axis tick labels (≈ `--muted-foreground`) */ axisLabel: string; /** Axis names, legend, title, and visualMap text (≈ `--foreground`) */ axisTitle: string; /** Axis, tick, and split (grid) lines (≈ `--border`) */ grid: string; /** Tooltip popover background (≈ `--popover`) */ tooltipBg: string; } /** Common visual and behavior props for all charts */ interface ChartBaseProps { /** Chart title */ title?: string; /** Show legend */ showLegend?: boolean; /** * Color palette to use. Auto-selected based on chart type if not specified. * - "categorical": Distinct colors for different categories (bar, pie, line) * - "sequential": Gradient for magnitude/intensity (heatmap) * - "diverging": Two-tone for positive/negative values */ colorPalette?: ChartColorPalette; /** Custom colors for series (overrides colorPalette) */ colors?: string[]; /** Chart height in pixels @default 300 */ height?: number; /** Additional CSS classes */ className?: string; /** X-axis field key. Auto-detected from schema if not provided. */ xKey?: string; /** Y-axis field key(s). Auto-detected from schema if not provided. */ yKey?: string | string[]; /** Accessibility label for screen readers */ ariaLabel?: string; /** Test ID for automated testing */ testId?: string; /** Additional ECharts options to merge */ options?: Record; } /** Props for query-based data fetching */ interface QueryProps extends ChartBaseProps { /** Analytics query key registered with analytics plugin */ queryKey: string; /** Query parameters passed to the analytics endpoint */ parameters?: Record; /** * Data format to use * - "json": Use JSON format (smaller payloads, simpler) * - "arrow": Use Arrow format (faster for large datasets) * - "auto": Automatically select based on expected data size * @default "auto" */ format?: DataFormat; /** Transform raw data before rendering */ transformer?: (data: T) => T; data?: never; } /** Props for direct data injection */ interface DataProps extends ChartBaseProps { /** Arrow Table or JSON array */ data: ChartData; queryKey?: never; parameters?: never; format?: never; transformer?: never; } /** Base union type - either query-based or data-based */ type UnifiedChartProps = QueryProps | DataProps; /** Props specific to bar charts */ interface BarChartSpecificProps { /** Chart orientation @default "vertical" */ orientation?: Orientation; /** Stack bars */ stacked?: boolean; } /** Props specific to line charts */ interface LineChartSpecificProps { /** Chart orientation @default "vertical" */ orientation?: Orientation; /** Show data point symbols @default false */ showSymbol?: boolean; /** Smooth line curves @default true */ smooth?: boolean; } /** Props specific to area charts */ interface AreaChartSpecificProps { /** Chart orientation @default "vertical" */ orientation?: Orientation; /** Show data point symbols @default false */ showSymbol?: boolean; /** Smooth line curves @default true */ smooth?: boolean; /** Stack areas @default false */ stacked?: boolean; } /** Props specific to scatter charts */ interface ScatterChartSpecificProps { /** Symbol size @default 8 */ symbolSize?: number; } /** Props specific to pie/donut charts */ interface PieChartSpecificProps { /** Inner radius for donut charts (0-100%) @default 0 */ innerRadius?: number; /** Show labels on slices @default true */ showLabels?: boolean; /** Label position @default "outside" */ labelPosition?: "outside" | "inside" | "center"; } /** Props specific to radar charts */ interface RadarChartSpecificProps { /** Show area fill @default true */ showArea?: boolean; } /** Props specific to heatmap charts */ interface HeatmapChartSpecificProps { /** * Field key for the Y-axis categories. * For heatmaps, data should have: xKey (column), yAxisKey (row), and yKey (value). */ yAxisKey?: string; /** Min value for color scale (auto-detected if not provided) */ min?: number; /** Max value for color scale (auto-detected if not provided) */ max?: number; /** Show value labels on cells @default false */ showLabels?: boolean; } type BarChartProps = (QueryProps | DataProps) & BarChartSpecificProps; type LineChartProps = (QueryProps | DataProps) & LineChartSpecificProps; type AreaChartProps = (QueryProps | DataProps) & AreaChartSpecificProps; type ScatterChartProps = (QueryProps | DataProps) & ScatterChartSpecificProps; type PieChartProps = (QueryProps | DataProps) & PieChartSpecificProps; type DonutChartProps = (QueryProps | DataProps) & PieChartSpecificProps; type RadarChartProps = (QueryProps | DataProps) & RadarChartSpecificProps; type HeatmapChartProps = (QueryProps | DataProps) & HeatmapChartSpecificProps; /** Base normalized data shared by all chart types */ interface NormalizedChartDataBase { xData: (string | number)[]; xField: string; yFields: string[]; chartType: "timeseries" | "categorical"; } /** Normalized chart data for rendering (standard charts) */ interface NormalizedChartData extends NormalizedChartDataBase { yDataMap: Record; } /** Type guard to check if data is an Arrow Table */ declare function isArrowTable(data: ChartData): data is Table; /** Type guard to check if props are query-based */ declare function isQueryProps(props: UnifiedChartProps): props is QueryProps; /** Type guard to check if props are data-based */ declare function isDataProps(props: UnifiedChartProps): props is DataProps; //#endregion export { AreaChartProps, AreaChartSpecificProps, BarChartProps, BarChartSpecificProps, ChartBaseProps, ChartColorPalette, ChartData, ChartType, ChartUITokens, DataFormat, DataProps, DonutChartProps, HeatmapChartProps, HeatmapChartSpecificProps, LineChartProps, LineChartSpecificProps, NormalizedChartData, NormalizedChartDataBase, Orientation, PieChartProps, PieChartSpecificProps, QueryProps, RadarChartProps, RadarChartSpecificProps, ScatterChartProps, ScatterChartSpecificProps, UnifiedChartProps, isArrowTable, isDataProps, isQueryProps }; //# sourceMappingURL=types.d.ts.map