title: D3 - how to deal with JSON data structures?
body: <p>I'm new to D3, and spent already a few hours to find out anything about dealing with structured data, but without positive result.
  I want to create a bar chart using data structure below.
  Bars are drawn (horizontally), but only for user "jim".</p>
  
  <pre><code>var data = [{"user":"jim","scores":[40,20,30,24,18,40]},
              {"user":"ray","scores":[24,20,30,41,12,34]}];
  
  var chart = d3.select("div#charts").append("svg")                                   
                .data(data)
                .attr("class","chart")
                .attr("width",800)
                .attr("height",350);
  
  chart.selectAll("rect")    
      .data(function(d){return d3.values(d.scores);})    
      .enter().append("rect")
      .attr("y", function(d,i){return i * 20;})
      .attr("width",function(d){return d;})
      .attr("height", 20);
  </code></pre>
  
  <p>Could anyone point what I did wrong?</p>