title: d3 csv data loading
body: <p>I am trying to adapt a simple scatterplot program in D3 to accept a CSV file. When I use the data in the file it works just fine, but when I try to load the CSV file it simply won't work. Is there something simple I am missing? The contents of the CSV file "datatest.csv" are the same as the dataset in the code. I have checked that the browser is loading the data, and it seems to all be there. I figure I'm simply missing a step. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;D3 Demo: Linear scales&lt;/title&gt;
      &lt;script type="text/javascript" src="../d3/d3.v3.js"&gt;&lt;/script&gt;
      &lt;style type="text/css"&gt;
          /* No style rules here yet */       
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script type="text/javascript"&gt;
  
          //Width and height
          var w = 900;
          var h = 500;
          var padding = 20;
          var dataset = [];
  
  //          var dataset = [
  //                          [5, 20], [480, 90], [250, 50], [100, 33], [330, 95],
  //                          [410, 12], [475, 44], [25, 67], [85, 21], [220, 88],
  //                          [600, 150]
  //                        ];
  
          d3.csv("datatest.csv", function(data) {
          dataset=data
          });
  
  
  
          //Create scale functions
          var xScale = d3.scale.linear()
                               .domain([0, d3.max(dataset, function(d) { return d[0]; })])
                               .range([padding, w - padding * 2]);
  
          var yScale = d3.scale.linear()
                               .domain([0, d3.max(dataset, function(d) { return d[1]; })])
                               .range([h - padding, padding]);
  
          var rScale = d3.scale.linear()
                               .domain([0, d3.max(dataset, function(d) { return d[1]; })])
                               .range([2, 5]);
  
          //Create SVG element
          var svg = d3.select("body")
                      .append("svg")
                      .attr("width", w)
                      .attr("height", h);
  
          svg.selectAll("circle")
             .data(dataset)
             .enter()
             .append("circle")
             .attr("cx", function(d) {
                  return xScale(d[0]);
             })
             .attr("cy", function(d) {
                  return yScale(d[1]);
             })
             .attr("r", function(d) {
                  return rScale(d[1]);
             });
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the content of the CSV file:</p>
  
  <pre><code>x-coordinate, y-coordinate
  5,20
  480,90
  250,50
  100,33
  330,95
  410,12
  475,44
  25,67
  85,21
  220,88
  600,150
  </code></pre>