Jose
Jose

Reputation: 617

Changing 'children' node in json

I am attempting to use d3s Collapsible tree. I am using a node hierarchy as seen in many of the examples. However, I am attempting to put my own node hierarchy data set e.g.

http://jsfiddle.net/Nszmg/2/

 var flare = {

"Name": "Example",
"children": [


    {
     "BName":"Ja",   
     "Email":"",
     "children":[
     {

        "NickName":"NC",
        "id":2

     },
     {

        "NickName":"Fi",
        "id":68

     }
  ],

 }
     ]};

Instead of having 'children' am I able to change it to another name? I have tried to find similar requests but havent found any to match.

I would appreicate if anyone had any advice of examples.

Upvotes: 1

Views: 214

Answers (2)

Juve
Juve

Reputation: 10834

You can use the children function of the tree layout.

var tree = d3.layout.tree()
    .size([height, width])
    .children(function(d) { return d.children1; });

Here is a forked fiddle with "children1" as property.

Upvotes: 1

Phong Vo
Phong Vo

Reputation: 1078

children is the key used in the core js to parse your parameter, so in case you want to change to another, I am afraid of you have to change the core but I don't encourage you do so.

Upvotes: 0

Related Questions