title: dc.js Number Display Widget
body: <p>I'm new to dc.js... and honestly have little clue what's going on with the number display widget. I tried looking at the example and essentially copied sections of it verbatim into my code hoping it would work (but knowing it wouldn't). My goal is to display the average of a line graph (sat scores) (that would change based on the crossfilter). Any suggestions?... </p>
  
  <pre><code>var ndx = crossfilter(csv);
  var all = ndx.groupAll();
  var bysat = ndx.dimension(function(d) { return d.compositesat; });
  
  var boxND = dc.numberDisplay("#number-box");
  
  var satavgnum = bysat.group().reduce(
            function (p, v) {
                ++p.n;
                p.tot += v.compositesat;
                return p;
            },
            function (p, v) {
                --p.n;
                p.tot -= v.compositesat;
                return p;
            },
            function () { return {n:0,tot:0}; }
        );
  
  var average = function(d) {
      return d.n ? d.tot / d.n: 0; };
  
  boxND
      .formatNumber(d3.format(".3s"))
      .valueAccessor(average)
      .group(satavgnum);
  </code></pre>