import { ChartBarLayout, ChartMargins, ChartSeries, ChartXConfig, ChartYConfig } from './types'; import { NormalizedData } from './engine/normalize'; import { PlotGeometry } from './engine/geometry'; import { StackMode } from './engine/stack'; export declare const DEFAULT_MARGINS: ChartMargins; export interface PlotBox { left: number; top: number; width: number; height: number; right: number; bottom: number; } /** Which series a plot draws as bars and which it stacks, resolved from its props. */ export interface PlotArrangement { /** Series drawn as bars, or null for none. Stacked bars draw exactly the stack's series. */ bars: readonly string[] | null; /** Series that stack, in chart series order, and how they combine. */ stack: { series: readonly string[]; mode: StackMode; } | null; /** * Series drawn by column marks such as candles or range bars: each observation takes a * bar-like slot, so the plot insets its edges like a bar chart. */ columns?: readonly string[]; /** Slot every observation like a bar even when nothing is drawn as one. */ slots?: boolean; } export declare const LINE_ARRANGEMENT: PlotArrangement; export interface ChartSnapshot { bars: readonly string[] | null; /** `signed` marks a sum stack with values below zero. */ stack: { series: readonly string[]; mode: StackMode; signed: boolean; } | null; barLayout: ChartBarLayout; stackWeights?: Readonly>; data: NormalizedData; xDomain: readonly [number, number]; yDomain: readonly [number, number] | null; xTicks: readonly number[]; yTicks: readonly number[]; xToPixel: (value: number) => number; yToPixel: (value: number) => number; /** Maps a value in a series' own unit, following `scale: 'secondary'`. */ yToPixelFor: (seriesId: string) => (value: number) => number; /** Width of one observation's column in pixels, for bars and column marks. */ columnWidth: number; /** Series drawn by column marks. */ columns: readonly string[]; geometry: PlotGeometry | null; /** * Lines and areas with more rows than pixels draw from this thinner geometry, which traces the * same ink; null when every row is drawn. Inspection and everything else read `geometry`. */ drawGeometry: PlotGeometry | null; plot: PlotBox; formatX: (value: number) => string; formatY: (value: number) => string; /** Raw measurements retain their unit when the plotted axis is normalized. */ formatValue: (value: number) => string; /** * Present when some series use `scale: 'secondary'`: their values equal primary values times * `factor`, so they share the primary ticks. */ secondary: { factor: number; format: (value: number) => string; } | null; } export interface AxisTick { value: number; entering?: boolean; leaving?: boolean; } export interface ChartContextValue { snapshot: ChartSnapshot; previousSnapshot: ChartSnapshot | null; series: readonly ChartSeries[]; xConfig: ChartXConfig; yConfig: ChartYConfig; margins: ChartMargins; width: number; height: number; revealProgress: number; reducedMotion: boolean; transitionDuration: number; transitionKind: 'initial' | 'matched-update' | 'topology-update' | null; axis: { x: readonly AxisTick[]; y: readonly AxisTick[]; }; clipId: string; gridGradientId: string; paintId: (seriesId: string, treatment: 'fade' | 'hatch' | 'dots') => string; inspectionSeries?: string; inspecting: boolean; focusedSeries?: string | null; visibleSeries: readonly string[]; } declare const ChartContext: import('react').Context | null>; export declare function ChartContextProvider({ value, children, }: { value: ChartContextValue; children: React.ReactNode; }): React.ReactElement; export declare function useChartContext(): ChartContextValue; export declare function defaultXFormatter(type: 'time' | 'number', value: number): string; export declare function defaultYFormatter(value: number): string; export declare function makeAxisTicks(snapshot: ChartSnapshot, previous: ChartSnapshot | undefined): { x: AxisTick[]; y: AxisTick[]; }; /** * Log ticks on 1, 2 and 5 times powers of ten when the domain spans decades; within a narrow * range, evenly spaced round values read better, so those come from a linear scale. */ export declare function logTicks(domain: readonly [number, number], count: number): number[]; export declare function buildSnapshot(data: NormalizedData, series: readonly ChartSeries[], xConfig: ChartXConfig, yConfig: ChartYConfig, margins: ChartMargins, width: number, height: number, yDomainOverride?: readonly [number, number] | null, xDomainOverride?: readonly [number, number] | null, geometrySeries?: readonly ChartSeries[], arrangement?: PlotArrangement, stackWeights?: Readonly>, barLayout?: ChartBarLayout, /** Keeps line and area observations off the plot edges so labels can center on them. */ edgeInset?: number, /** Draw long lines and areas from at most four rows per pixel column. */ decimate?: boolean): ChartSnapshot; export { ChartContext };