function initializeBars(comparable) {
// We create a new element using jQuery. We can style it in CSS using the .bar-chart class.
  $('.sandbox').append('<div class="bar-chart"></div>');

// We reduce our comparable to yearly totals
  yearTotals = _.map(comparable, function(obj,iter){
    var valueArray = _.pluck(obj.stats, "value");
    return _.reduce(valueArray, function(memo,num) { return memo + num });
  }); //_.map

// For each of this yearly totals, create a bar in our new bar chart.
  $.each(yearTotals, function(key,value){
    $('.bar-chart').append('<div class="bar" data-index="'+comparable[key].id+'" data-value="'+value+'"><span><em>' + comparable[key].id + ':</em> <strong>' + ""+ '</strong></span></div>');
    // $('.bar-chart').append('<div class="bar" data-index="'+comparable[key].id+'" data-value="'+value+'"><span><em>' + comparable[key].id + ':</em> <strong>' + commafy(value) + '</strong></span></div>');
  }); //each yearTotals

//////// Step 1A: Make the length of each bar relative to its $ spent
   relativeBarWidths();

//////// Step 1B: Drop another level of metrics in: a breakdown of the yearly spend
   createLegend(comparable);
   applyCategories(comparable);

//////// Step 1C: Make the width of each category proportional to 
   setCategoryWidths();
   setCategoryRatios(comparable);

}
/*=======================================================
STEP 1: STATIC BAR GRAPH
=======================================================*/
STEP 1: STATIC BAR GRAPH
STEP 1 : STATIC BAR GRAPH
function initializeBars(comparable) {
  $('.sandbox').append('<div class="bar-chart"></div>');
  yearTotals = _.map(comparable, function(obj,iter){
    var valueArray = _.pluck(obj.stats, "value");
    return _.reduce(valueArray, function(memo,num) { return memo + num });
  }); 
  $.each(yearTotals, function(key,value){
    $('.bar-chart').append('<div class="bar" data-index="'+comparable[key].id+'" data-value="'+value+'"><span><em>' + comparable[key].id + ':</em> <strong>' + ""+ '</strong></span></div>');
  }); 
   relativeBarWidths();
   createLegend(comparable);
   applyCategories(comparable);
   setCategoryWidths();
   setCategoryRatios(comparable);
}
function initializeBars ( comparable ) { $ ( '.sandbox' ) . append ( '<div class="bar-chart"></div>' ) ; yearTotals = _ . map ( comparable , function ( obj , iter ) { var valueArray = _ . pluck ( obj . stats , "value" ) ; return _ . reduce ( valueArray , function ( memo , num ) { return memo + num } ) ; } ) ; $ . each ( yearTotals , function ( key , value ) { $ ( '.bar-chart' ) . append ( '<div class="bar" data-index="' + comparable [ key ] . id + '" data-value="' + value + '"><span><em>' + comparable [ key ] . id + ':</em> <strong>' + "" + '</strong></span></div>' ) ; } ) ; relativeBarWidths ( ) ; createLegend ( comparable ) ; applyCategories ( comparable ) ; setCategoryWidths ( ) ; setCategoryRatios ( comparable ) ; }
STEP 1: STATIC BAR GRAPH
STEP 1 : STATIC BAR GRAPH
// We create a new element using jQuery. We can style it in CSS using the .bar-chart class. // We reduce our comparable to yearly totals //_.map // For each of this yearly totals, create a bar in our new bar chart. // $('.bar-chart').append('<div class="bar" data-index="'+comparable[key].id+'" data-value="'+value+'"><span><em>' + comparable[key].id + ':</em> <strong>' + commafy(value) + '</strong></span></div>'); //each yearTotals //////// Step 1A: Make the length of each bar relative to its $ spent //////// Step 1B: Drop another level of metrics in: a breakdown of the yearly spend //////// Step 1C: Make the width of each category proportional to 