reaviz
Version:
Data Visualization using React
74 lines (72 loc) • 1.94 kB
TypeScript
import { FC } from 'react';
import { SankeyNodeExtra } from '../utils';
export type SankeyLabelPosition = 'inside' | 'outside';
export interface SankeyLabelFormatProps {
x: number;
y: number;
textAnchor: string;
node: SankeyNodeExtra;
}
export interface SankeyLabelProps {
/**
* Whether the element is active or not. Set internally by `Sankey`.
*/
active: boolean;
/**
* Whether the label is disabled. Set internally by `Sankey`.
*/
disabled: boolean;
/**
* Width of the chart. Set internally by `Sankey`.
*/
chartWidth?: number;
/**
* CSS class to apply.
*/
className?: string;
/**
* Fill color.
*/
fill: string;
/**
* Label position. Set internally by `Sankey`.
*/
position?: SankeyLabelPosition;
/**
* Percentage of total width occupied by labels on
* either side of the graph inside the container.
* Used for auto-ellipsizing labels
* Set internally by `Sankey`.
*/
labelPadding?: number;
/**
* Node data. Set internally by `Sankey`.
*/
node?: SankeyNodeExtra;
/**
* Opacity callback. Used internally by `Sankey`.
*/
opacity: (active: boolean, disabled: boolean) => number;
/**
* Padding between the label and the node.
*/
padding?: string | number;
/**
* Whether to show the label or not.
*/
visible: boolean;
/**
* Width of the node set by the 'Sankey'.
*/
nodeWidth: number;
/**
* Custom formatting for the label.
*/
format?: (value: SankeyLabelFormatProps) => any;
/**
* Specify the number of characters at which the text would be ellipsized.
* Defaults to 'auto' based on available width and max cut-off at `LABEL_TRUNCATE_LENGTH=10`
*/
ellipsis?: number | 'none' | 'auto';
}
export declare const SankeyLabel: FC<Partial<SankeyLabelProps>>;