This is the code for Chapter 2, Figure 14 from D3.js in Action that creates rectangles with height based on the data bound to the selection. The rectangles are positioned along the X axis based on the array position of the datapoint that each retangle represents.
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js