This is the code for Chapter 2, Figure 16 from D3.js in Action that creates rectangles with height based on the data bound to the selection. Rectangles are being drawn off-screen because the values in the array do not correspond to screen values.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js