How exactly the bars(or rectangles) are created in d3 barChart demo part 1?
<p>I understand every line of the <a href="https://bl.ocks.org/mbostock/7322386" rel="nofollow">barchart source code</a> . However, besides code on setting each <code>div</code>'s <code>width</code> using <code>.style("width", function(d) { return x(d) + "px"; })</code>, I don't see codes specifically saying  "let's make bars or rectangles". </p>

<pre><code>var data = [4, 8, 15, 16, 23, 42];

var x = d3.scale.linear()
    .domain([0, d3.max(data)])
    .range([0, 420]);

d3.select(".chart")
  .selectAll("div")
    .data(data)
  .enter().append("div")
    .style("width", function(d) { return x(d) + "px"; })
    .text(function(d) { return d; });
</code></pre>

<p>My question: </p>

<p>Was the demo code a quick and dirty way of producing bars? Is there a formal or standard way of creating rectangles or bars using d3? </p>

<p>Thanks</p>