/** * @fileOverview Render a group of bar */ import * as React from 'react'; import { Key, PureComponent, ReactElement } from 'react'; import { Series } from 'victory-vendor/d3-shape'; import { Props as RectangleProps } from '../shape/Rectangle'; import { BarPositionPosition, StackId } from '../util/ChartUtils'; import { ActiveShape, AnimationDuration, AnimationTiming, ChartOffset, Coordinate, DataKey, LegendType, PresentationAttributesAdaptChildEvent, TickItem, TooltipType } from '../util/types'; import { ImplicitLabelType } from '../component/Label'; import { MinPointSize } from '../util/BarUtils'; import { BarSettings } from '../state/selectors/barSelectors'; import { BaseAxisWithScale } from '../state/selectors/axisSelectors'; export interface BarRectangleItem extends RectangleProps { value?: number | [number, number]; /** the coordinate of background rectangle */ background?: { x?: number; y?: number; width?: number; height?: number; }; tooltipPosition: Coordinate; } export interface BarProps { className?: string; index?: Key; xAxisId?: string | number; yAxisId?: string | number; stackId?: StackId; barSize?: string | number; unit?: string | number; name?: string | number; dataKey: DataKey; tooltipType?: TooltipType; legendType?: LegendType; minPointSize?: MinPointSize; maxBarSize?: number; hide?: boolean; shape?: ActiveShape; activeBar?: ActiveShape; background?: ActiveShape; radius?: number | [number, number, number, number]; onAnimationStart?: () => void; onAnimationEnd?: () => void; isAnimationActive?: boolean; animationBegin?: number; animationDuration?: AnimationDuration; animationEasing?: AnimationTiming; id?: string; label?: ImplicitLabelType; } type BarMouseEvent = (data: BarRectangleItem, index: number, event: React.MouseEvent) => void; interface BarEvents { onClick: BarMouseEvent; onMouseEnter: BarMouseEvent; onMouseLeave: BarMouseEvent; onMouseMove: BarMouseEvent; } type BarSvgProps = Omit, 'radius' | 'name' | 'ref'>; export type Props = Partial & BarProps & Omit; export declare function computeBarRectangles({ layout, barSettings: { dataKey, minPointSize: minPointSizeProp }, pos, bandSize, xAxis, yAxis, xAxisTicks, yAxisTicks, stackedData, dataStartIndex, displayedData, offset, cells, }: { layout: 'horizontal' | 'vertical'; barSettings: BarSettings; pos: BarPositionPosition; bandSize: number; xAxis?: BaseAxisWithScale; yAxis?: BaseAxisWithScale; xAxisTicks: TickItem[]; yAxisTicks: TickItem[]; stackedData: Series, DataKey> | undefined; dataStartIndex: number; offset: ChartOffset; displayedData: any[]; cells: ReadonlyArray | undefined; }): ReadonlyArray | undefined; export declare class Bar extends PureComponent { static displayName: string; static defaultProps: Partial; render(): React.JSX.Element; } export {};