I have been using d3.tree to render a family tree like in this js fiddle.But the nodes in this tree are appended in breath first manner(their append order is marked with a / and their order eg:"/13")so my question is that
Is there a way to make a d3 family tree in top-down or bottom-up manner?
as ksav asked what did I mean by breath first manner: What I meant to say is that the nodes having same depth get appended first while its children nodes having more depth get appended later(their append order is denoted by "/append_order" for eg "/13").So when some parents have more children they come under their siblings the children(look at children of "Ls" and "LSH" in last layer).So if there is any way where the children are appended just after their parents and before their parents siblings so that may result in the siblings of those parents moving to the side as more children add on.Basically top-down or bottom-up approach
this is the data structure I have used:
var root_13=
{
name: "",
id: 1,
hidden: true,
no_parent: true,
children:
[{
name: "LF",
id: 16,
no_parent: true,
status:"M",
gender:"Male"
},{
name: "",
id: 2,
no_parent: true,
hidden: true,
children: [
{
name: "LS",
id: 139,
status:"M",
gender:"Female"
},{
name: "",
id: 128,
status:"M",
no_parent: true,
hidden:true,
children: [{
name: "LS child1",
id: 128,
status:"M",
no_parent: false,
hidden:false,
children: []
},{
name: "",
id: 1289,
status:"M",
no_parent: true,
hidden:true,
children: []
},{
name: "child1 part",
id: 1281,
status:"M",
no_parent: true,
hidden:false,
children: []
},{
name: "child 2",
id: 1289,
status:"M",
no_parent: false,
hidden:false,
children: []
},{
name: "",
id: 1280,
status:"M",
no_parent: true,
hidden:true,
children: []
},{
name: "child 2 part",
id: 12891,
status:"M",
no_parent: true,
hidden:false,
children: []
},{
name: "child 3",
id: 12891,
status:"M",
no_parent: false,
hidden:false,
children: []
},{
name: "",
id: 12891,
status:"M",
no_parent: true,
hidden: true,
children: []
},{
name: "child 3",
id: 12891,
status:"M",
no_parent: true,
hidden:false,
children: []
}]
},{
name: "LSH",
id: 138,
status:"M",
gender:"Male",
no_parent:true
},{
name: "L",
id: 13,
status:"M",
gender:"Male"
},{
name: "",
id: 122,
status:"M",
no_parent: true,
hidden:true,
children: []
},{
name: "J",
id: 12,
status:"M",
no_parent: true,
gender:"Female"
},{
name: "JS",
id: 125,
status:"M",
no_parent: false,
gender:"Female"
},{
name: "",
id: 12,
status:"M",
no_parent: true,
hidden: true,
gender:"Female"
},{
name: "JP",
id: 12,
status:"M",
no_parent: true,
gender:"Female"
}]
},
{
name: "LM",
id: 10,
no_parent: true,
status:"M",
gender:"Female",
children: []
}
]
}