This is the code for Chapter 2, Figure 25 from D3.js in Action that draws a scatterplot from loaded JSON data. For each datapoint in the loaded data, an SVG g element is rendered, each of which has an SVG circle and SVG text element as children. The g element is placed according to the attributes of the data, while the circle element is sized according to the data and the text element has its .text() populated from the data.