UNPKG

1.22 kBTypeScriptView Raw
1/**
2 * @fileOverview Curve
3 */
4import React from 'react';
5import { CurveFactory } from 'victory-vendor/d3-shape';
6import { LayoutType, PresentationAttributesWithProps } from '../util/types';
7export type CurveType = 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | CurveFactory;
8export interface Point {
9 x: number;
10 y: number;
11}
12interface CurveProps {
13 className?: string;
14 type?: CurveType;
15 layout?: LayoutType;
16 baseLine?: number | Array<Point>;
17 points?: Array<Point>;
18 connectNulls?: boolean;
19 path?: string;
20 pathRef?: (ref: SVGPathElement) => void;
21}
22export type Props = Omit<PresentationAttributesWithProps<CurveProps, SVGPathElement>, 'type' | 'points'> & CurveProps;
23type GetPathProps = Pick<Props, 'type' | 'points' | 'baseLine' | 'layout' | 'connectNulls'>;
24/**
25 * Calculate the path of curve. Returns null if points is an empty array.
26 * @return path or null
27 */
28export declare const getPath: ({ type, points, baseLine, layout, connectNulls, }: GetPathProps) => string | null;
29export declare const Curve: React.FC<Props>;
30export {};