'use strict';

require('../globals');

module.exports = binning;

function binning(dataTable, encoding, opt) {
  opt = opt || {};

  if (!dataTable.transform) dataTable.transform = [];

  encoding.forEach(function(field, encType) {
    if (encoding.bin(encType)) {
      dataTable.transform.push({
        type: 'bin',
        field: 'data.' + field.name,
        output: 'data.bin_' + field.name,
        maxbins: encoding.bin(encType).maxbins
      });
    }
  });
}

@@ -331,70 +331,94 @@
 ld: 
-'data.' + field.name,%0A        output: 'data.bin_' + field.name
+encoding.field(encType, false, /*nofn*/ true),%0A        output: encoding.field(encType)
 ,%0A  

correct use encoding.field in bin