@nivo/funnel
Version:
91 lines • 5.57 kB
TypeScript
import { ScaleLinear } from 'd3-scale';
import { TooltipActionsContextData } from '@nivo/tooltip';
import { PartTooltipProps } from './PartTooltip';
import { FunnelDatum, FunnelCommonProps, FunnelDataProps, FunnelPart, SeparatorProps, FunnelCustomLayerProps, FunnelAreaGenerator, FunnelBorderGenerator, SizeSpec } from './types';
export declare const computeShapeGenerators: <D extends FunnelDatum>(interpolation: FunnelCommonProps<D>["interpolation"], direction: FunnelCommonProps<D>["direction"]) => [FunnelAreaGenerator, FunnelBorderGenerator];
interface CustomBandScale {
(index: number): number;
bandwidth: number;
}
export declare const computeScales: <D extends FunnelDatum>({ data, direction, width, height, spacing, }: {
data: FunnelDataProps<D>["data"];
direction: FunnelCommonProps<D>["direction"];
width: number;
height: number;
spacing: number;
}) => [CustomBandScale, ScaleLinear<number, number>];
export declare const computeSeparators: <D extends FunnelDatum>({ parts, direction, width, height, spacing, enableBeforeSeparators, beforeSeparatorOffset, enableAfterSeparators, afterSeparatorOffset, }: {
parts: FunnelPart<D>[];
direction: FunnelCommonProps<D>["direction"];
width: number;
height: number;
spacing: number;
enableBeforeSeparators: boolean;
beforeSeparatorOffset: number;
enableAfterSeparators: boolean;
afterSeparatorOffset: number;
}) => SeparatorProps[][];
export declare const computePartsHandlers: <D extends FunnelDatum>({ parts, setCurrentPartId, isInteractive, onMouseEnter, onMouseLeave, onMouseMove, onClick, showTooltipFromEvent, hideTooltip, tooltip, }: {
parts: FunnelPart<D>[];
setCurrentPartId: (id: string | number | null) => void;
isInteractive: FunnelCommonProps<D>["isInteractive"];
onMouseEnter?: FunnelCommonProps<D>["onMouseEnter"];
onMouseLeave?: FunnelCommonProps<D>["onMouseLeave"];
onMouseMove?: FunnelCommonProps<D>["onMouseMove"];
onClick?: FunnelCommonProps<D>["onClick"];
showTooltipFromEvent: TooltipActionsContextData["showTooltipFromEvent"];
hideTooltip: () => void;
tooltip?: (props: PartTooltipProps<D>) => JSX.Element;
}) => FunnelPart<D>[];
export declare const getSizeGenerator: <Datum extends FunnelDatum>(config: SizeSpec<Datum> | undefined, linearScale: ScaleLinear<number, number>) => ((datum: Datum) => number);
export declare const useSize: <Datum extends FunnelDatum>(config: SizeSpec<Datum> | undefined, linearScale: ScaleLinear<number, number>) => ((datum: Datum) => number);
/**
* Creates required layout to generate a funnel chart,
* it uses almost the same parameters as the Funnel component.
*
* For purpose/constrains on the parameters, please have a look
* at the component's props.
*/
export declare const useFunnel: <D extends FunnelDatum>({ data, width, height, direction, interpolation, spacing, shapeBlending: rawShapeBlending, valueFormat, colors, size, fillOpacity, borderWidth, borderColor, borderOpacity, labelColor, enableBeforeSeparators, beforeSeparatorLength, beforeSeparatorOffset, enableAfterSeparators, afterSeparatorLength, afterSeparatorOffset, isInteractive, currentPartSizeExtension, currentBorderWidth, onMouseEnter, onMouseMove, onMouseLeave, onClick, tooltip, }: {
data: FunnelDataProps<D>["data"];
width: number;
height: number;
direction?: FunnelCommonProps<D>["direction"];
interpolation?: FunnelCommonProps<D>["interpolation"];
spacing?: FunnelCommonProps<D>["spacing"];
shapeBlending?: FunnelCommonProps<D>["shapeBlending"];
valueFormat?: FunnelCommonProps<D>["valueFormat"];
colors?: FunnelCommonProps<D>["colors"];
size?: FunnelCommonProps<D>["size"];
fillOpacity?: FunnelCommonProps<D>["fillOpacity"];
borderWidth?: FunnelCommonProps<D>["borderWidth"];
borderColor?: FunnelCommonProps<D>["borderColor"];
borderOpacity?: FunnelCommonProps<D>["borderOpacity"];
labelColor?: FunnelCommonProps<D>["labelColor"];
enableBeforeSeparators?: FunnelCommonProps<D>["enableBeforeSeparators"];
beforeSeparatorLength?: FunnelCommonProps<D>["beforeSeparatorLength"];
beforeSeparatorOffset?: FunnelCommonProps<D>["beforeSeparatorOffset"];
enableAfterSeparators?: FunnelCommonProps<D>["enableAfterSeparators"];
afterSeparatorLength?: FunnelCommonProps<D>["afterSeparatorLength"];
afterSeparatorOffset?: FunnelCommonProps<D>["afterSeparatorOffset"];
isInteractive?: FunnelCommonProps<D>["isInteractive"];
currentPartSizeExtension?: FunnelCommonProps<D>["currentPartSizeExtension"];
currentBorderWidth?: FunnelCommonProps<D>["currentBorderWidth"];
onMouseEnter?: FunnelCommonProps<D>["onMouseEnter"];
onMouseMove?: FunnelCommonProps<D>["onMouseMove"];
onMouseLeave?: FunnelCommonProps<D>["onMouseLeave"];
onClick?: FunnelCommonProps<D>["onClick"];
tooltip?: (props: PartTooltipProps<D>) => JSX.Element;
}) => {
parts: FunnelPart<D>[];
areaGenerator: FunnelAreaGenerator;
borderGenerator: FunnelBorderGenerator;
beforeSeparators: SeparatorProps[];
afterSeparators: SeparatorProps[];
setCurrentPartId: import("react").Dispatch<import("react").SetStateAction<string | number | null>>;
currentPartId: string | number | null;
customLayerProps: FunnelCustomLayerProps<D>;
};
export declare const useFunnelAnnotations: <D extends FunnelDatum>(parts: FunnelPart<D>[], annotations: FunnelCommonProps<D>["annotations"]) => import("@nivo/annotations").BoundAnnotation<FunnelPart<D>>[];
export {};
//# sourceMappingURL=hooks.d.ts.map