recharts
Version:
React charts
49 lines (48 loc) • 1.76 kB
TypeScript
import * as React from 'react';
import { SVGProps } from 'react';
import { SymbolType as D3SymbolType } from 'victory-vendor/d3-shape';
import { RechartsFill } from '../fill/RechartsFill';
import { SymbolType } from '../util/types';
/**
* @public
*/
export type SizeType = 'area' | 'diameter';
/**
* Returns how far a symbol reaches horizontally from its center, in pixels.
* Useful to connect a line to the edge of a symbol, because most symbols are narrower than their size.
*
* @param type symbol type
* @param size symbol size, interpreted according to `sizeType`
* @param sizeType how to interpret `size`
* @returns the largest horizontal distance of the symbol outline from its center
*/
export declare function getSymbolHalfWidth(type: SymbolType, size: number, sizeType: SizeType): number;
export interface InnerSymbolsProp {
/**
* The fill of the symbol. Either a color string, or a {@link RechartsFill} object with an SVG definition,
* such as a pattern or a gradient. Recharts renders the definition with a unique ID.
* Set the `color` of the fill object: there is no theme color to fall back to.
*
* @since 3.11
* @example <Symbols fill={{ color: 'blue', definition: pattern(patterns.diagonal) }} />
*/
fill?: string | RechartsFill;
className?: string;
type?: SymbolType;
cx?: number;
cy?: number;
size?: number;
sizeType?: SizeType;
}
/**
* @public
*/
export type SymbolsProps = Omit<SVGProps<SVGPathElement>, 'type' | 'fill'> & InnerSymbolsProp;
/**
* Renders a symbol from a set of predefined shapes.
* @public
*/
export declare const Symbols: {
(props: SymbolsProps): React.JSX.Element;
registerSymbol: (key: string, factory: D3SymbolType) => void;
};