function buildArray (source, response, total, trunc, pct, cullNull) {
      return _.filter(_.map(_.cloneDeep(source), function (o) {
        o.name = o.title;

        // Truncate flag
        if (trunc) {
            o.count = _.isNumber(response[o.id]) ? response[o.id].toFixed(2) : null;
        } else {
            o.count = _.isNumber(response[o.id]) ? response[o.id] : null;
        }

        // Percentage flag
        if (pct) {
          if (cullNull && o.count === null) {
            o.count = null;
          } else {
            o.count = calcPct(o.count, total);
          }
        }

        return o;
      }), function (obj) {
        return obj.type !== 'activityGroup' && obj.count !== null;
      });
    }
// Build array for locations/activities bar chart
Build array for locations/activities bar chart
Build array for locations / activities bar chart
function buildArray (source, response, total, trunc, pct, cullNull) {
      return _.filter(_.map(_.cloneDeep(source), function (o) {
        o.name = o.title;
        if (trunc) {
            o.count = _.isNumber(response[o.id]) ? response[o.id].toFixed(2) : null;
        } else {
            o.count = _.isNumber(response[o.id]) ? response[o.id] : null;
        }
        if (pct) {
          if (cullNull && o.count === null) {
            o.count = null;
          } else {
            o.count = calcPct(o.count, total);
          }
        }
        return o;
      }), function (obj) {
        return obj.type !== 'activityGroup' && obj.count !== null;
      });
    }
function buildArray ( source , response , total , trunc , pct , cullNull ) { return _ . filter ( _ . map ( _ . cloneDeep ( source ) , function ( o ) { o . name = o . title ; if ( trunc ) { o . count = _ . isNumber ( response [ o . id ] ) ? response [ o . id ] . toFixed ( 2 ) : null ; } else { o . count = _ . isNumber ( response [ o . id ] ) ? response [ o . id ] : null ; } if ( pct ) { if ( cullNull && o . count === null ) { o . count = null ; } else { o . count = calcPct ( o . count , total ) ; } } return o ; } ) , function ( obj ) { return obj . type !== 'activityGroup' && obj . count !== null ; } ) ; }
Build array for locations/activities bar chart
Build array for locations / activities bar chart
// Truncate flag // Percentage flag