reaviz
Version:
Data Visualization using React
61 lines (59 loc) • 2.24 kB
TypeScript
import { FC, ReactElement } from 'react';
import { ChartProps } from '../common/containers/ChartContainer';
import { ColorSchemeType } from '../common/color';
import { SankeyNodeProps, SankeyNode } from './SankeyNode';
import { SankeyLinkProps, SankeyLink } from './SankeyLink';
import { SankeyLabelPosition } from './SankeyLabel';
export type Justification = 'justify' | 'center' | 'left' | 'right';
export type NodeElement = ReactElement<SankeyNodeProps, typeof SankeyNode>;
export type LinkElement = ReactElement<SankeyLinkProps, typeof SankeyLink>;
export interface SankeyProps extends ChartProps {
/**
* Whether to animate the enter/update/exit. Set internally by `SankeyNode` and `SankeyLink`.
*/
animated?: boolean;
/**
* Color scheme for the nodes. Set internally by `SankeyNode`.
*/
colorScheme?: ColorSchemeType;
/**
* The node alignment method.
*/
justification?: Justification;
/**
* Width of the node.
*/
nodeWidth?: number;
/**
* Vertical padding between nodes in the same column.
*/
nodePadding?: number;
/**
* Label position.
*/
labelPosition?: SankeyLabelPosition;
/**
* Sort function for the nodes.
*
* If sort is specified, sets the node sort method and returns this Sankey generator.
* If sort is not specified, returns the current node sort method, which defaults
* to undefined, indicating that vertical order of nodes within each column will
* be determined automatically by the layout. If sort is null, the order is fixed
* by the input. Otherwise, the specified sort function determines the order;
* the function is passed two nodes, and must return a value less than 0 if the
* first node should be above the second, and a value greater than 0 if the second
* node should be above the first, or 0 if the order is not specified.
*
* Reference: https://github.com/d3/d3-sankey#sankey_nodeSort
*/
nodeSort?: (a: any, b: any) => number;
/**
* Nodes that are rendered.
*/
nodes: NodeElement[];
/**
* Links that are rendered.
*/
links: LinkElement[];
}
export declare const Sankey: FC<SankeyProps>;