recharts
Version:
React charts
127 lines (126 loc) • 4.1 kB
TypeScript
import * as React from 'react';
import { SVGProps } from 'react';
import { RechartsFill } from '../fill/RechartsFill';
interface SectorProps {
/**
* The fill of the sector. 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 <Sector fill={{ color: 'blue', definition: pattern(patterns.diagonal) }} />
*/
fill?: string | RechartsFill;
/**
* The SVG element's class name.
*/
className?: string;
/**
* The x-coordinate of center.
* @default 0
*/
cx?: number;
/**
* The y-coordinate of center.
* @default 0
*/
cy?: number;
/**
* The inner radius of the sector.
* @default 0
*/
innerRadius?: number;
/**
* The outer radius of the sector.
* @default 0
*/
outerRadius?: number;
/**
* The start angle of the sector.
* @default 0
*/
startAngle?: number;
/**
* The end angle of the sector.
* @default 0
*/
endAngle?: number;
/**
* The radius of corners.
* If the sector is too narrow to fit the corners, they shrink to the largest radius that fits,
* unless `forceCornerRadius` is set.
* @default 0
*/
cornerRadius?: number;
/**
* When true, a sector that is too narrow to fit its corners renders as a circle with the full cornerRadius,
* instead of shrinking the corners to fit.
* @default false
*/
forceCornerRadius?: boolean;
/**
* When false (default), the rounded corners are inset within the
* angle defined by `startAngle`/`endAngle`, keeping the sector within
* its nominal bounds. When true, the corners extend beyond that
* angle, making the sector appear visually wider at its rounded ends.
*/
cornerIsExternal?: boolean;
/**
* The customized event handler of click on the sector
*/
onClick?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mousedown on the sector
*/
onMouseDown?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mouseup on the sector
*/
onMouseUp?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mousemove on the sector
*/
onMouseMove?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mouseover on the sector
*/
onMouseOver?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mouseout on the sector
*/
onMouseOut?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mouseenter on the sector
*/
onMouseEnter?: (e: React.MouseEvent<SVGPathElement>) => void;
/**
* The customized event handler of mouseleave on the sector
*/
onMouseLeave?: (e: React.MouseEvent<SVGPathElement>) => void;
}
/**
* SVG cx, cy are `string | number | undefined`, but internally we use `number` so let's
* override the types here.
* @public
*/
export type Props = Omit<SVGProps<SVGPathElement>, 'cx' | 'cy' | 'dangerouslySetInnerHTML' | 'fill'> & Partial<SectorProps>;
export declare const defaultSectorProps: {
readonly cx: 0;
readonly cy: 0;
readonly innerRadius: 0;
readonly outerRadius: 0;
readonly startAngle: 0;
readonly endAngle: 0;
readonly cornerRadius: 0;
readonly forceCornerRadius: false;
readonly cornerIsExternal: false;
};
/**
* Renders a sector (pie-slice or donut-segment shape) from center
* coordinates, inner/outer radius, and start/end angles. Used by polar
* components such as Pie, RadialBar, and PolarGrid, and as the radial
* cursor shape shown by Tooltip on polar charts.
* @public
*/
export declare const Sector: (props: Props) => React.JSX.Element;
export {};