export const scaleBand: FactoryFn; type DataItem = { readonly [field: string]: any; }; export type DataItems = ReadonlyArray; export type DomainItems = ReadonlyArray; export type NumberArray = number[]; export interface ScaleObject { (value: any): number; /** A function that returns an array of ticks */ ticks?(ticks?: number): DomainItems; /** A function that sets the current domain */ domain(domain: DomainItems): this; /** A function that gets the current domain */ domain(): DomainItems; /** A function that returns a tick formatter function */ tickFormat?(count?: number, format?: string): GetFormatFn; /** A function that returns each band’s width */ bandwidth?(): number; /** A function that sets the current range */ range(range: NumberArray): this; /** A function that gets the current range */ range(): NumberArray; /** Returns an exact copy of this scale */ copy(): this; /** Enables or disables clamping */ clamp?(clamp: boolean): this; /** A function that sets a scale’s inner padding and returns the current scale */ paddingInner?(arg: number): this; /** A function that sets a scale’s outer padding and returns the current scale */ paddingOuter?(arg: number): this; /** A function that returns the corresponding value from the domain */ invert?(value: number): any; } export type ScalesCache = { readonly [key: string]: ScaleObject; }; export interface Point { /** Point value */ readonly value: any; /** Point index */ readonly index: number; /** Point color */ readonly color: string; } export interface TransformedPoint extends Point { /** The point's translated argument */ readonly arg: number; /** The point's translated value */ readonly val: number; /** The point's translated start value */ readonly startVal?: number; } /** The object that points at a clicked series */ export interface SeriesRef { /** Series name */ readonly series: string; /** The point’s index within the data array */ readonly point: number; } export type TargetList = ReadonlyArray; export type GetFormatFn = (tick: any) => string; export type Colors = ReadonlyArray; export type PointDistance = { readonly index: number; readonly distance: number; }; export type Location = Readonly; type HitTestResult = { readonly points: ReadonlyArray; } | null; export type HitTestFn = (location: Location) => HitTestResult; export interface TooltipReference { readonly clientWidth: number; readonly clientHeight: number; getBoundingClientRect(): Partial; } export interface Stack { /** A list of series names */ readonly series: string[]; } export type StackData = ReadonlyArray>; export type OrderFn = (series: StackData) => number[]; export type OffsetFn = (series: StackData, order: Iterable) => void; export type StackList = ReadonlyArray; export type StacksOptions = { stacks: StackList; offset: OffsetFn; order: OrderFn; }; export type PathPoints = ReadonlyArray; export type GetPointFieldFn = (point: PointComponentProps) => number; export interface PathFn { (points: PathPoints): string; x(): GetPointFieldFn; x(f: GetPointFieldFn): this; y(): GetPointFieldFn; y(f: GetPointFieldFn): this; y0?(): GetPointFieldFn; y0?(f: GetPointFieldFn): this; y1?(): GetPointFieldFn; y1?(f: GetPointFieldFn): this; x0?(): GetPointFieldFn; x0?(f: GetPointFieldFn): this; x1?(): GetPointFieldFn; x1?(f: GetPointFieldFn): this; curve?(): any; curve?(c: any): this; context(ctx: any): this; } export interface CommonComponentProps { /** A color */ color: string; } export interface PathComponentProps extends CommonComponentProps { /** Coordinates of the series' points */ coordinates: PathPoints; } export interface PointComponentProps extends CommonComponentProps { /** Point index */ index: number; /** Point argument */ argument: any; /** Point value */ value: any; /** coordinate on argument axis */ arg: number; /** coordinate on value axis */ val: number; /** start coordinate on value axis */ startVal: number; } export interface SeriesProps { /** A series argument field */ argumentField: string; /** A series value field */ valueField: string; /** A series name */ name?: string; /** A series scale name */ scaleName?: string; /** A series color */ color?: string; } export interface PathComponentPathProps extends PathComponentProps { /** A function used to calculate the series’ path */ path?: PathFn; } export interface AreaSeriesProps extends SeriesProps { /** A component that renders series */ seriesComponent?: React.ComponentType; } export namespace AreaSeries { /** Describes properties passed to a component that renders the series */ interface SeriesProps extends PathComponentPathProps { } /** Describes properties of a component that renders series */ interface PathSeriesProps extends SeriesProps { } } export interface LineSeriesProps extends SeriesProps { /** A component that renders series */ seriesComponent?: React.ComponentType; } export namespace LineSeries { /** Describes properties passed to a component that renders the series */ interface SeriesProps extends PathComponentPathProps { } /** Describes properties of a component that renders series */ interface PathSeriesProps extends SeriesProps { } } export interface SplineSeriesProps extends SeriesProps { /** A component that renders series */ seriesComponent?: React.ComponentType; } export namespace SplineSeries { /** Describes properties passed to a component that renders the series */ interface SeriesProps extends PathComponentPathProps { } /** Describes properties of a component that renders series */ interface PathSeriesProps extends SeriesProps { } } export namespace BarSeries { /** Describes properties passed to a component that renders a bar */ interface PointProps extends PointComponentProps { /** The bar width in relative units */ barWidth: number; /** The maximum width that the bar can occupy, measured in pixels */ maxBarWidth: number; } } export interface BarSeriesProps extends SeriesProps { /** The bar width in relative units */ barWidth?: number; /** A component that renders a bar */ pointComponent?: React.ComponentType; } export namespace PieSeries { /** Describes properties passed to a component that renders the slice */ interface PointProps extends PointComponentProps { /** The slice's maximum radius in pixels */ maxRadius: number; /** The inner radius in relative units */ innerRadius: number; /** The outer radius in relative units */ outerRadius: number; /** The slice's start angle */ startAngle: number; /** The slice's end angle */ endAngle: number; } } export interface PieSeriesProps extends SeriesProps { /** The inner radius in relative units */ innerRadius?: number; /** The outer radius in relative units */ outerRadius?: number; /** A component that renders point */ pointComponent?: React.ComponentType; } export namespace ScatterSeries { /** Describes point options */ type PointOptions = { size: number; }; /** Describes properties passed to a component that renders the point */ interface PointProps extends PointComponentProps { /** Point options */ point: PointOptions; } /** Describes properties passed to a component that renders the series */ interface SeriesProps extends PathComponentProps { } } export interface ScatterSeriesProps extends SeriesProps { /** Point options */ point?: ScatterSeries.PointOptions; /** A component that renders point */ pointComponent?: React.ComponentType; } export type FactoryFn = () => ScaleObject; export type ModifyDomainFn = (domain: DomainItems) => DomainItems; export type TickFormatFn = (scale: ScaleObject, count?: number) => GetFormatFn; export type Viewport = { readonly argumentStart?: any; readonly argumentEnd?: any; readonly scaleName?: string; readonly valueStart?: any; readonly valueEnd?: any; }; export type OnViewportChangeFn = (viewport: Viewport) => void; export type Interaction = 'none' | 'pan' | 'zoom' | 'both'; /** The click event data */ export interface TargetData { /** The clicked point’s coordinates [x, y] (relative to the chart’s plot) */ readonly location: Location; /** An array of clicked series */ readonly targets: TargetList; /** The event data */ readonly event?: any; } export type HandlerFn = (arg: TargetData) => void; export type HandlerFnList = ReadonlyArray; export type NotifyPointerMoveFn = (target: SeriesRef | null) => void;