recharts
Version:
React charts
51 lines (50 loc) • 2.66 kB
TypeScript
import * as React from 'react';
import { type Props as DotProps } from './Dot';
import { ActiveDotType, DotType, SymbolType } from '../util/types';
import type { LegendPayloadDot } from '../component/DefaultLegendContent';
type DotSymbolProps = DotProps & {
type: SymbolType;
};
/**
* Returns the predefined symbol that a `dot` or `activeDot` option asks for:
* either the option itself (`dot="diamond"`), or its `symbol` field (`dot={{ symbol: 'diamond' }}`).
*
* @param option the `dot` or `activeDot` prop
* @returns the symbol name, or undefined if the option renders a circle or a custom dot
*/
export declare function getDotSymbol(option: DotType | ActiveDotType | undefined): SymbolType | undefined;
/**
* Describes the dots of a graphical item for its legend icon,
* so that the icon draws the same symbol with the same colors as the dots.
*
* Without a theme, the default circle dots keep the default `line` legend icon, so that existing legends stay
* unchanged. With a theme, they are described as a `circle` so that the legend icon follows their theme colors.
* A custom dot (a function or an element) is never described, because the legend cannot know what it draws.
*
* @param dot the `dot` prop, after defaults
* @param seriesDotColors the colors that the dots get from the graphical item, including the theme
* @param isThemed true if the chart renders with a Recharts theme
* @returns the legend dot, or undefined if the legend icon does not draw the dots
*/
export declare function getLegendPayloadDot(dot: DotType | undefined, seriesDotColors: {
fill: string | undefined;
stroke: string | undefined;
}, isThemed: boolean): LegendPayloadDot | undefined;
/**
* The default legend icon of Line and Area with a theme when they draw no dots:
* a plain line, because there is no dot to show.
* Without a theme, the default `line` icon stays, so that existing legends stay unchanged.
*
* @param dot the `dot` prop, after defaults
* @param isThemed true if the chart renders with a Recharts theme
* @returns `plainline` if the legend should show a plain line by default, otherwise undefined
*/
export declare function getNoDotsLegendType(dot: DotType | undefined, isThemed: boolean): 'plainline' | undefined;
/**
* Renders a predefined symbol in place of a {@link Dot}, used when `dot` or `activeDot` asks for a symbol.
*
* It accepts the same props as Dot and handles them the same way, including event handlers.
* The symbol spans the same diameter as the dot would, so `circle` looks the same as the default dot.
*/
export declare function DotSymbol(props: DotSymbolProps): React.JSX.Element;
export {};