UNPKG

recharts

Version:
32 lines (31 loc) • 1.69 kB
import type { RechartsRootState } from '../store'; import type { NormalizedStackId } from '../../util/ChartUtils'; import type { BarSettings } from '../types/BarSettings'; export declare const selectAllBarsInStack: (state: RechartsRootState, stackId: NormalizedStackId, isPanorama: boolean) => ReadonlyArray<BarSettings>; export type BarStackItem = { x: number; y: number; width: number; height: number; }; /** * Takes two rectangles and returns a new rectangle that encompasses both. * It takes the minimum x and y, and the maximum width and height. * It handles overlapping rectangles, and rectangles with a gap between them. * @param rect1 * @param rect2 */ export declare const expandRectangle: (rect1: BarStackItem | undefined, rect2: BarStackItem | undefined) => BarStackItem | undefined; export declare const selectStackRects: (state: RechartsRootState, stackId: NormalizedStackId, isPanorama: boolean) => ReadonlyArray<BarStackItem | undefined>; export declare const combineMaxStrokeWidthOfStack: (allBars: ReadonlyArray<Pick<BarSettings, "strokeWidth">>) => number; /** * Selects the largest strokeWidth of all bars in the stack. * The stack clip path grows by half of this value in every direction. */ export declare const selectMaxStrokeWidthOfStack: (state: RechartsRootState, stackId: NormalizedStackId, isPanorama: boolean) => number; /** * Grows the rectangle by the given amount in every direction. * Rectangles with negative width or height (stackOffset="sign") are normalized * so that the returned rectangle always has non-negative dimensions. */ export declare const inflateRectangle: (rect: BarStackItem, inflation: number) => BarStackItem;