victory-bar
Version:
Bar Component for Victory
130 lines • 6.89 kB
TypeScript
import React from "react";
import { Data, Domain, EventPropTypeInterface, NumberOrCallback, StringOrNumberOrCallback, VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps, VictoryStyleInterface, EventsMixinClass } from "victory-core";
export type VictoryBarCornerRadiusKey = "top" | "bottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
export type VictoryBarCornerRadiusObject = Partial<Record<VictoryBarCornerRadiusKey, NumberOrCallback>>;
export type VictoryBarTTargetType = "data" | "labels" | "parent";
export type VictoryBarAlignmentType = "start" | "middle" | "end";
export interface VictoryBarProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabelableProps {
alignment?: VictoryBarAlignmentType;
barRatio?: number;
barWidth?: NumberOrCallback;
cornerRadius?: NumberOrCallback | VictoryBarCornerRadiusObject;
events?: EventPropTypeInterface<VictoryBarTTargetType, number | string | number[] | string[]>[];
eventKey?: StringOrNumberOrCallback;
getPath?: (props: VictoryBarProps) => string;
style?: VictoryStyleInterface;
}
interface VictoryBarBase extends EventsMixinClass<VictoryBarProps> {
}
/**
* Draw SVG bar charts with React. VictoryBar is a composable component, so it doesn"t include axes
* Check out VictoryChart for complete bar charts and more.
*/
declare class VictoryBarBase extends React.Component<VictoryBarProps> {
static animationWhitelist: (keyof VictoryBarProps)[];
static displayName: string;
static role: string;
static defaultTransitions: {
onLoad: {
duration: number;
before: () => {
_y: number;
_y1: number;
_y0: number;
};
after: (datum: any) => {
_y: any;
_y1: any;
_y0: any;
};
};
onExit: {
duration: number;
before: () => {
_y: number;
yOffset: number;
};
};
onEnter: {
duration: number;
before: () => {
_y: number;
_y1: number;
_y0: number;
};
after: (datum: any) => {
_y: any;
_y1: any;
_y0: any;
};
};
};
static defaultProps: VictoryBarProps;
static getDomain: typeof Domain.getDomainWithZero;
static getData: typeof Data.getData;
static getBaseProps(props: VictoryBarProps): any;
static expectedComponents: (keyof VictoryBarProps)[];
static shouldRenderDatum: () => boolean;
shouldAnimate(): boolean;
render(): React.ReactElement;
}
export declare const VictoryBar: {
new (props: import("victory-core").EventMixinCommonProps): {
state: {};
getEventState: (eventKey: string | number, namespace: string, childType?: string | undefined) => any;
getScopedEvents: (events: any, namespace: any, childType: any, baseProps: any) => {};
getEvents: (p: any, target: any, eventKey: any) => any;
externalMutations: {} | undefined;
calculatedState: {};
globalEvents: {};
prevGlobalEventKeys: string[];
boundGlobalEvents: {};
shouldComponentUpdate(nextProps: import("victory-core").EventMixinCommonProps): boolean;
componentDidMount(): void;
componentDidUpdate(prevProps: any): void;
componentWillUnmount(): void;
addGlobalListener(key: any): void;
removeGlobalListener(key: any): void;
getStateChanges(props: any): {};
applyExternalMutations(props: any, externalMutations: any): void;
getCalculatedValues(props: any): import("victory-core").EventMixinCalculatedValues;
getExternalMutations(props: import("victory-core").EventMixinCommonProps): {} | undefined;
cacheValues(obj: any): void;
getBaseProps(props: any, getSharedEventState: any): Record<string, object>;
getAllEvents(props: any): any;
getComponentProps(component: React.ReactNode, type: string, index: string | number): any;
renderContainer(component: any, children: any): React.DetailedReactHTMLElement<any, HTMLElement>;
animateComponent(props: import("victory-core").EventMixinCommonProps, defaultAnimationWhitelist: string[]): React.ReactElement;
renderContinuousData(props: import("victory-core").EventMixinCommonProps): React.DetailedReactHTMLElement<any, HTMLElement>;
renderData(props: any, shouldRenderDatum?: (datum: any) => boolean): React.DetailedReactHTMLElement<any, HTMLElement>;
context: unknown;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("victory-core").EventMixinCommonProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
render(): React.ReactNode;
readonly props: Readonly<import("victory-core").EventMixinCommonProps>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<import("victory-core").EventMixinCommonProps>, prevState: Readonly<{}>): any;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("victory-core").EventMixinCommonProps>, nextState: Readonly<{}>, nextContext: any): void;
componentEvents: Array<import("@/victory-core/lib/victory-util/events").ComponentEvent>;
getSharedEventState: (key: string, value: string) => unknown;
baseProps: Record<string, object>;
dataKeys: string[];
hasEvents: unknown;
events: unknown;
};
getBaseProps?(props: import("victory-core").EventMixinCommonProps): import("victory-core").EventMixinCalculatedValues["baseProps"];
role?: import("victory-core").VictoryComponentRole;
expectedComponents?: string[] | undefined;
getChildren?: ((props: import("victory-core").EventMixinCommonProps, childComponents?: Array<React.ReactNode>, calculatedProps?: import("victory-core").EventMixinCommonProps | undefined) => void) | undefined;
animationWhitelist?: string[] | undefined;
} & typeof VictoryBarBase;
export {};
//# sourceMappingURL=victory-bar.d.ts.map