lineage/export/svg
Renders a Heritage family tree as a standalone SVG document.
Individuals are laid out in rows by generation (the same depth produced
by heritage.flatten): ancestors above the center row, descendants
below. Parent–child relationships within the rendered set are drawn as
connecting lines. The result is a plain SVG string that can be written to
a file or embedded directly in a page.
Types
pub type DisplayMode {
Phenotype(
visualize: fn(individual.Individual, individual.SpeciesRules) -> dict.Dict(
String,
String,
),
icon_size: Float,
)
CompactGenes(
visualize: fn(individual.Individual, individual.SpeciesRules) -> List(
List(String),
),
)
}
Constructors
-
Phenotype( visualize: fn(individual.Individual, individual.SpeciesRules) -> dict.Dict( String, String, ), icon_size: Float, ) -
CompactGenes( visualize: fn(individual.Individual, individual.SpeciesRules) -> List( List(String), ), )
pub type LayoutConfig {
LayoutConfig(
label: fn(List(individual.Individual)) -> dict.Dict(
String,
String,
),
mode: DisplayMode,
)
}
Constructors
-
LayoutConfig( label: fn(List(individual.Individual)) -> dict.Dict( String, String, ), mode: DisplayMode, )
Values
pub fn to_svg(
heritage: heritage.Heritage,
center: individual.Individual,
rules: individual.SpeciesRules,
config: option.Option(LayoutConfig),
) -> String
Renders the family tree of center within heritage as an SVG document.
Examples
let document = svg.to_svg(heritage, member)
simplifile.write("family.svg", document)