When using the Bubble Chart, data should be flattened. In the example you linked, there is a call to a function called "classes", which for each node returns the class as a new object with the value property containing the size. (The code above indicates that you did not specify this call).
Subsequently, the call to the bubble.nodes function uses the value property for each object created by the function of the classes (which were placed in one array) to calculate x and y (which, in turn, is used within the conversion function). For more information on package features, see d3 docs . The same nodes function also calculates the radius (like r ), which is used later.
This is a nodes call that defines the complete layout of a bubble chart. The rest of the code in the sample consists in building the necessary SVG elements, such as a circle and text, in positions determined by the results calculated by the nodes function.
Thus, you cannot pass json data directly to bubble.nodes if it does not meet specific requirements (for example, it has a value property).
Here is a working example on jsfiddle.net.
source share