reaviz
Version:
Data Visualization using React
83 lines (81 loc) • 2.25 kB
TypeScript
import { default as React, ReactElement, FC } from 'react';
import { Tooltip, TooltipProps } from 'reablocks';
import { SankeyLabel, SankeyLabelPosition, SankeyLabelProps } from '../SankeyLabel';
import { SankeyNodeExtra } from '../utils';
export interface SankeyNodeProps extends SankeyNodeExtra {
/**
* ID of the node. If not provided, the node's index will be used.
*/
id?: string;
/**
* Title of the node.
*/
title: string;
/**
* Color of the node.
*/
color?: string;
/**
* Whether the element is active or not. Set internally by `Sankey`.
*/
active: boolean;
/**
* Whether to animate the enter/update/exit.
*/
animated: boolean;
/**
* Width of the chart. Set internally by `Sankey`.
*/
chartWidth?: number;
/**
* CSS class to apply.
*/
className?: string;
/**
* Whether the node is disabled. Set internally by `Sankey`.
*/
disabled: boolean;
/**
* Label element.
*/
label: ReactElement<SankeyLabelProps, typeof SankeyLabel>;
/**
* Label position. Set internally by `Sankey`.
*/
labelPosition?: SankeyLabelPosition;
/**
* Percentage of total width occupied by labels on
* either side of the graph inside the container.
* Set internally by `Sankey`.
*/
labelPadding?: number;
/**
* Opacity callback for the node.
*/
opacity: (active: boolean, disabled: boolean) => number;
/**
* CSS styles to apply.
*/
style?: React.StyleHTMLAttributes<SVGRectElement>;
/**
* Tooltip element.
*/
tooltip?: ReactElement<TooltipProps, typeof Tooltip> | null;
/**
* Width of the node. Set internally by `Sankey`.
*/
width?: number;
/**
* Event for when the node is clicked.
*/
onClick?: (event: React.MouseEvent<SVGRectElement>) => void;
/**
* Event for when the node has mouse enter.
*/
onMouseEnter?: (event: React.MouseEvent<SVGRectElement>) => void;
/**
* Event for when the node has mouse leave.
*/
onMouseLeave?: (event: React.MouseEvent<SVGRectElement>) => void;
}
export declare const SankeyNode: FC<Partial<SankeyNodeProps>>;