BenPortner / js_family_tree

An interactive family tree visualization using d3-dag
GNU General Public License v3.0
70 stars 29 forks source link

Making a vertical family tree #7

Open Ayesha-Sayyed opened 2 years ago

Ayesha-Sayyed commented 2 years ago

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

BenPortner commented 2 years ago

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

dthemg commented 1 year ago

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