sankyy
Version:
<a href="https://nivo.rocks"><img alt="nivo" src="https://raw.githubusercontent.com/plouc/nivo/master/nivo.png" width="216" height="68"/></a>
30 lines • 1.48 kB
TypeScript
import { DefaultLink, DefaultNode, SankeySvgProps } from './types';
export interface DraggableSankeyProps<N extends DefaultNode, L extends DefaultLink> extends SankeySvgProps<N, L> {
/** called on every mousemove while a node is dragged */
onNodeDrag?: (nodeId: string, x: number, y: number) => void;
/** called once on mouseup (drag finished) */
onNodeDragEnd?: (nodeId: string, x: number, y: number) => void;
/**
* Manually override the vertical positions of nodes.
* Provide a map from node.id to an object containing a `y` value.
* The node's x-coordinate will still be computed by d3-sankey.
*/
initialNodePositions?: Record<string, {
x?: number;
y?: number;
}>;
}
export interface DraggableSankeyHandle {
/** reset all manual overrides so the diagram reverts to its computed layout */
resetNodePositions: () => void;
}
/**
* A thin wrapper around the Nivo Sankey component that lets users
* drag nodes around. It keeps a `nodePositions` map in its own state
* and forwards it to the underlying <Sankey>. Links automatically
* follow because the custom hook inside the library recomputes their
* layout whenever positions change.
*/
export declare const DraggableSankey: import("react").ForwardRefExoticComponent<DraggableSankeyProps<DefaultNode, DefaultLink> & import("react").RefAttributes<DraggableSankeyHandle>>;
export default DraggableSankey;
//# sourceMappingURL=DraggableSankey.d.ts.map