js_family_tree icon indicating copy to clipboard operation
js_family_tree copied to clipboard

Making a vertical family tree

Open Ayesha-Sayyed opened this issue 2 years ago • 2 comments

how can i change tree from a horizontal view to a vertical one ?

Ayesha-Sayyed avatar Apr 18 '22 07:04 Ayesha-Sayyed

Hi @Ayesha-Sayyed,

Thanks for using js_family_tree. I just pushed version 0.2.0, which implements a new orientation setter/getter. To get a vertical family tree, you can use it as follows:

        // insert svg object to hold the family tree
        const svg = d3.select("body").append("svg")
            .attr("width", document.body.offsetWidth)
            .attr("height", document.documentElement.clientHeight);

        // make family tree object
        FT = new FamilyTree(data, svg).orientation("vertical");

        // draw family tree
        FT.draw();

Let me know if it works for you! :)

Cheers. Ben

BenPortner avatar Jul 14 '22 12:07 BenPortner

I found a bug in the vertical links, opened a PR for it :)

dthemg avatar Aug 05 '22 16:08 dthemg