3

My colleague and I are working with a D3 visualization. Specifically we are starting with this example. This visualization appears to use some kind of json related to the flare API

In the sample json, there's lines like:

 "name": "cluster",
 "children": [
  {"name": "AgglomerativeCluster", "size": 3938},
  {"name": "CommunityStructure", "size": 3812},
  {"name": "HierarchicalCluster", "size": 6714},
  {"name": "MergeEdge", "size": 743}

I understand that stuff after "name" relates to a Flare class. What I can't seem to find, despite lots of googling, is what exactly "size" is and what its units are? More generally, where can one find some kind of specification on flare's json format and what it means?

Doug T.
  • 64,223
  • 27
  • 138
  • 202
  • I think it is used to determine the size of the node. As you can see in this snippet: `var pack = d3.layout.pack() .size([diameter - 4, diameter - 4]) .value(function(d) { return d.size; });` `size` is passed in to the `value` function which computes the radius for the node. – icanc Mar 07 '13 at 21:30
  • @icanc size in pixels? – Doug T. Mar 07 '13 at 21:35
  • 3
    No, `"size"` can be used to represent a value associated with the entity. For example, if we had `"name": "Stackoverflow"` and `"size": "3,000,000"`. In this case "size" would represent the number of members in here. D3 takes this value and computes the appropriate radius for this node by taking into account the number of nodes and the size of the diameter. I hope that makes sense. – icanc Mar 07 '13 at 21:42
  • I added this snippet Tejen suggested, `var pack = d3.layout.pack().size([ 4, 4]).value(function(d) { return d.size; });` but even if I manipulate the flare.json and make for one of the nodes the 'size' very large, its diameter doesn't change. What do you mean value function. In the original http://bl.ocks.org/mbostock/4339083 or http://bl.ocks.org/mbostock/4063570 there is no value function. Can you please suggest where should this snippet be entered to have an effect on radius and instead of value function which other corresponding function from the collapsible example would it be? Thanks! – HR123r Aug 02 '15 at 17:46

1 Answers1

0

It is not used by the node-link tree layout example that you are referring to. The size is used in other examples like treemap, bubble layout, circle packing, bubble layout, icicle, sunburst, etc. You will see the impact of size using the flare.json file with those examples.