.pluck(this.group_field)
.uniq()
.map(function (value, index) {
- if(value)
- value = value.toLowerCase().replace(/[\s\/]+/g,'_')
+ if(value) {
+ value = value.toLowerCase().replace(/[\s\/]+/g,'_');
+ }
return {
- group: self.ordinate + '_' +
- value,
+ group: _.str.sprintf('%s_%s', self.ordinate, value),
text: value,
color: COLOR_PALETTE[index % COLOR_PALETTE.length]
};
// second argument is coerced to a str, no good for boolean
r[self.abscissa] = records[0][self.abscissa];
_(records).each(function (record) {
- if(record[self.group_field])
- record[self.group_field] = record[self.group_field].toLowerCase().replace(/[\s\/]+/g,'_')
- var key = _.str.sprintf('%s_%s',
- self.ordinate,
- record[self.group_field]);
+ var value = record[self.group_field];
+ if(value) {
+ record[self.group_field] = value.toLowerCase().replace(/[\s\/]+/g,'_');
+ }
+ var key = _.str.sprintf('%s_%s', self.ordinate, value);
r[key] = record[self.ordinate];
});
return r;