import DataHandler from '../src/utils/DataHandler'

let customDataHandlers = {
  getXYByQueryData: function (componentData, dashboardData, handler, e, pipelineData) {
    console.log('gbXY', arguments);
    if (componentData && componentData.length > 0) {
      console.log('gXY-A');
      let localData = componentData[handler.queryKey].result.records;
      let output =  localData.map(row => {
        return {age: row.age, count_age: row.count_age }
      });
      return [output];
    } 
  },

  groupByRange: function (componentData, dashboardData, handler, e, pipelineData) {
    let data = pipelineData || componentData;
    console.log('BYRANGE', arguments, data);
    let finalOutput = []; // array of series
    data.forEach(series => {
      let outputSeries = []; // an array of objects
      for (let i in handler.ranges) {
        let lowerBound = handler.ranges[i][0];
        let upperBound = handler.ranges[i][1];
        let xVal = lowerBound + ' - ' + upperBound;
        let yVal = 0;
        let groupedRow = {};
        // loop through vals for current range, if it's in the range, add to the running yVal sum;
        series.forEach(row => {
          // if it's in the range, add it to this range's sum
          if (row[handler.xField] >= lowerBound && row[handler.xField] <= upperBound) {
            yVal += parseInt(row[handler.yField]);
          }
        })
        
        groupedRow[handler.xField] = xVal;
        groupedRow[handler.yField] = yVal;
        outputSeries.push(groupedRow);
      }
      // now add our transformed series to the array of series for output
      finalOutput.push(outputSeries);
    });

    console.log('FF', finalOutput); 
    return finalOutput;
  },

  getFTE: function (componentData, dashboardData, handler, e, pipelineData) {
    console.log('getFTE', arguments);
    return [['FTE Value']];
  }
}

for (let k in customDataHandlers) {
  DataHandler.set(k, customDataHandlers[k]);
}

export default customDataHandlers;

@@ -72,16 +72,502 @@
 ers = %7B%0A
+%09customDataHandler: function (componentData, dashboardData, handler, e, pipelineData) %7B%0A%09%09let _data = pipelineData %7C%7C componentData;%0A%09%09let dates = e.value.split('_') %7C%7C 'ALL';%0A%09%09if (dates%5B0%5D === 'all') %7B%0A%09%09%09return _data;%0A%09%09%7D else %7B%0A%09%09%09let low = Date.parse(dates%5B0%5D);%0A%09%09%09let high = Date.parse(dates%5B1%5D);%0A%09%09%09let vals = _data;%0A%09%09%09let filteredVals = vals.filter(d =%3E %7B console.log(d); return (Date.parse(d.date) %3E= low && Date.parse(d.date) %3C= high) %7D);%0A%09%09%09return filteredVals;   %0A%09%09%7D%0A%09%7D,%0A%0A
   getXYB

Add handler for gold chart in examples