title: Why is domain not using d3.max(data) in D3?
body: <p>I'm new to D3 and playing around with a scatterplot.  I cannot get d3.max(data) to work correctly in setting up domain!</p>
  
  <p>I have the following setting up a random dataset:</p>
  
  <pre><code>var data = [];
        for (i=0; i &lt; 40; i++){
              data.push({"x": i/40, "y": i/8, "a": Math.floor(Math.random() * 3), "x2": Math.random()});
          }
  </code></pre>
  
  <p>And then the following to set my coordinates:</p>
  
  <pre><code> var x = d3.scale.linear().domain([0, 1]).range([0 + margin, w-margin]),
              y = d3.scale.linear().domain([0, d3.max(data)]).range([0 + margin, h-margin]),
              c = d3.scale.linear().domain([0, 3]).range(["hsl(100,50%,50%)", "rgb(350, 50%, 50%)"]).interpolate(d3.interpolateHsl);
  </code></pre>
  
  <p>This puts all 40 points in a single, horizontal line.  If I replace d3.max(data) with '5' then it is a diagonal (albeit from the upper left to the bottom right, I'm still struggling to flip y-coordinates).  Why isn't d3.max(data) working as expected?</p>