trassel
Version:
Graph computing in JavaScript
31 lines (30 loc) • 1.57 kB
TypeScript
/**
* Creates an hierarhical component that sorts nodes on an axis (either y or x) based on the Sugiyama Framework
* To learn more about the sugiyama framework and hierarchical graph layouts check out this great video series by Philipp Kindermann:
* https://www.youtube.com/watch?v=3_FbSCWLC3A
* @param {(any => "string")=} computeGroup - A function that will take the node as an argument and return a group ID. If left blank the groups will be computed.
* @param {boolean=} useY - If true the hierachy will be top to bottom, otherwise it will be left to right
* @param {number=} distance - How much space should be between nodes. If not set this will be determined by the size of the nodes
* @param {boolean=} useLine - If set nodes will be set into a fixed order, trying to minimize edge crossings.
* @param {number=} centerX - Center X coordinate of the component
* @param {number=} centerY - Center Y coordinate of the component
*/
export default class Hierarchy extends LayoutComponent {
constructor(computeGroup?: null, useY?: boolean, distance?: undefined, useLine?: boolean, centerX?: null, centerY?: null);
computeGroup: any;
useY: boolean;
distance: any;
useLine: boolean;
centerX: number | null;
centerY: number | null;
groups: any[];
offsetDistance: number;
halfSize: number;
halfWidth: number;
orderMeasurement: number;
offsetSizeMultiplier: number;
getWidth(node: any): any;
getHeight(node: any): any;
initialize(...args: any[]): void;
}
import LayoutComponent from "./layoutcomponent";