I'm basicaly working with this .
Now, the flare.json is something like
{ "name": "flare", "children": [ { "name": "analytics", "children": [ { "name": "cluster",...
I need more information to be displayed, not just the name so after fetching the data I have something like.
{ "name": "John Smith", "Age": "20", "Country": "Canada", "children": [ { //and so on
All nodes will have more fields than just "name", let's say 3 or 4 items in total.
The code part for appending the data is
nodeEnter.append("svg:text")
.attr("dy", 3.5)
.attr("dx", 5.5)
.text(function(d) { return d.name; });
I've tryed return d.name + ' - ' + d.age;});
but it just works on the root node. On all the children it says the name properly but instead of the Age.Text it says [object Object]
Basicaly I need to access not just the "name" from the flare.json file but a few more items.
Thanks in advance.
It works fine with the size
attribute that is already present in the data. See here for an example. What I've done is change the .text
to
.text(function(d) { return d.name + (d.size ? " " + d.size : ""); });
which will display the size information if it is present.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.