recharts
Version:
React charts
129 lines (128 loc) • 4.37 kB
TypeScript
import * as React from 'react';
import { SVGProps } from 'react';
import { AxisId } from '../state/cartesianAxisSlice';
import { Percent } from '../util/types';
import { ZIndexable } from '../zIndex/ZIndexLayer';
import { RechartsFill } from '../fill/RechartsFill';
interface PolarGridProps extends ZIndexable {
/**
* The x-coordinate of center.
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
* and this prop is ignored.
*
* This is only used when rendered outside a chart context.
*/
cx?: number;
/**
* The y-coordinate of center.
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
* and this prop is ignored.
*
* This is only used when rendered outside a chart context.
*/
cy?: number;
/**
* The radius of the inner polar grid.
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
* and this prop is ignored.
*
* This is only used when rendered outside a chart context.
*/
innerRadius?: number;
/**
* The radius of the outer polar grid.
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
* and this prop is ignored.
*
* This is only used when rendered outside a chart context.
*/
outerRadius?: number;
/**
* The array of every line grid's angle.
*/
polarAngles?: ReadonlyArray<number>;
/**
* The array of every circle grid's radius.
*
* A number is the radius in pixels.
* A percentage string such as `'50%'` is relative to the outer radius of the grid,
* so `'100%'` draws the outermost circle and the grid keeps its proportions when the chart is resized.
* For example, `polarRadius={['25%', '50%', '75%', '100%']}` draws four evenly spaced circles.
* Numbers and percentages can be mixed.
*/
polarRadius?: ReadonlyArray<number | Percent>;
/**
* The type of polar grids.
* @defaultValue polygon
*/
gridType?: 'polygon' | 'circle';
/**
* Whether to render the radial lines extending from the inner radius to the outer edge at each angle.
* When false, only the circular or polygonal grid lines are rendered.
* @defaultValue true
*/
radialLines?: boolean;
/**
* @defaultValue 0
*/
angleAxisId?: AxisId;
/**
* @defaultValue 0
*/
radiusAxisId?: AxisId;
/**
* Z-Index of this component and its children. The higher the value,
* the more on top it will be rendered.
* Components with higher zIndex will appear in front of components with lower zIndex.
* If undefined or 0, the content is rendered in the default layer without portals.
*
* @since 3.4
* @defaultValue -100
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
*/
zIndex?: number;
/**
* The stroke color. If "none", no line will be drawn.
*/
stroke?: string;
/**
* The width of the stroke.
*/
strokeWidth?: number | string;
/**
* The pattern of dashes and gaps used to paint the lines of the grid.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray stroke-dasharray on MDN}
*/
strokeDasharray?: string | number;
/**
* The background used to fill the space between grid lines: a color, or a {@link RechartsFill} object
* with an SVG definition, such as a pattern or a gradient.
*
* @example <PolarGrid fill={{ color: '#eee', definition: pattern(patterns.dots) }} />
*/
fill?: string | RechartsFill;
/**
* The opacity of the background used to fill the space between grid lines.
*/
fillOpacity?: number | string;
}
/**
* @public
*/
export type Props = Omit<SVGProps<SVGLineElement>, 'fill'> & PolarGridProps;
export declare const defaultPolarGridProps: {
readonly angleAxisId: 0;
readonly radiusAxisId: 0;
readonly gridType: "polygon";
readonly radialLines: true;
readonly zIndex: -100;
};
/**
* @consumes PolarViewBoxContext
* @public
*/
export declare const PolarGrid: {
(propsWithFillObject: Props): React.JSX.Element | null;
displayName: string;
};
export {};