UNPKG

topola

Version:

Topola – online genealogy visualization

42 lines (41 loc) 2.06 kB
import { BaseType, Selection } from 'd3-selection'; import { HierarchyPointNode } from 'd3-hierarchy'; import { Chart, ChartInfo, ChartOptions, Fam, Indi, TreeNode } from './api'; import { ChartUtil, ChartSizeInfo } from './chart-util'; /** Renders a fancy descendants tree chart. * * It draws stylized leaves (colored circles behind individuals), organic branch paths, * and a decorative tree trunk at the base of the tree. * The layout uses D3 data binding to allow smooth updates and re-rendering. */ export declare class FancyChart<IndiT extends Indi, FamT extends Fam> implements Chart { readonly options: ChartOptions; readonly util: ChartUtil; constructor(options: ChartOptions); /** Creates a path from parent to the child node (vertical layout). */ private linkVertical; private linkAdditionalMarriage; /** * Renders the two-tone background blocks (cyan "sky" above, green "grass" below). * Keeps them at the back of the SVG container by inserting them before any other elements. */ renderBackground(chartInfo: ChartSizeInfo, svg: Selection<BaseType, {}, BaseType, {}>): void; /** * Renders stylized circular green backdrops ("leaves") behind all descendant family tree nodes. * A radial gradient is created (and reused) to give the outer ring of nodes a soft glowing edge. */ renderLeaves(nodes: Array<HierarchyPointNode<TreeNode>>, svg: Selection<BaseType, {}, BaseType, {}>): void; /** * Renders the connection paths (branches) between family nodes. * Uses organic Bezier curves styled as tree branches rather than standard block lines. */ renderLinks(nodes: Array<HierarchyPointNode<TreeNode>>, svg: Selection<BaseType, {}, BaseType, {}>): void; /** * Renders a decorative tree trunk at the base of the root node. */ renderTreeTrunk(nodes: Array<HierarchyPointNode<TreeNode>>, svg: Selection<BaseType, {}, BaseType, {}>): void; /** * Lays out, scales, and draws the fancy descendant chart. */ render(): ChartInfo; }