Calculate average instead of counting in barchart
<p>I have dc.js bar-chart,
the y axis for the chart is counting the number each element in the x axis(level)
but I don't want to count the number of each level
I want to calculate the average of the GPA.</p>

<p>The problem is that the char is dealing with one column only
but want two columns </p>

<p>This the data in the csv(mep,csv):</p>

<pre><code>GPA,level,gender,year
3.34,B+,F,2003
1.98,C-,M,2003
2.81,B-,M,2005
2.12,C,M,2006
</code></pre>

<p>This the call of Java script function:</p>

<pre><code>&lt;script&gt;
$(function() {
    d3.csv("mep.csv", function(d) {return d;}
      ,function(error, rows) {
      grid ("#ep2014list",rows);
      });      
    });      
&lt;/script&gt;
</code></pre>

<p>This the bar-chart code:</p>

<pre><code>&lt;script&gt;
function grid (selector,data) {
  var ndx = crossfilter(data),
      all = ndx.groupAll();
  var bar_level = dc.barChart(selector + " .level");
  var level = ndx.dimension(function(d) {
      if (typeof d.level == "undefined") return "";
      return d.level;
      });
  var levelGroup   = level.group().reduceSum(function(d) { return 1; });
  bar_level
    .width(700)
    .height(200)
    .outerPadding(0)
    .gap(1)
    .margins({top: 10, right: 0, bottom: 100, left: 30})
    .x(d3.scale.ordinal())
    .xUnits(dc.units.ordinal)
    .brushOn(false)
    .elasticY(true)
    .yAxisLabel("#Avg")
    .dimension(level)
    .group(levelGroup); 
dc.renderAll();
}
&lt;/script&gt;
&lt;div id="ep2014list"&gt;
&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;
&lt;div class="group"&gt;&lt;/div&gt;
&lt;div class="dc-data-count"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="ep2014list"&gt;
&lt;div class="level"&gt;&lt;/div&gt;
&lt;div class="dc-data-count"&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>