Following code snippet:
toBarChart =  function (d){
  var tData = [{values: []}];
    angular.copy(d, tData[0].values)
  return tData;
}
Following code snippet:
toBarChart =  function (d){
  var tData = [{values: []}];
    angular.copy(d, tData[0].values)
  return tData;
}
 
    
     
    
    Just simply use the Object.assign(...) which will copy all the values of properties from the source to target object.
Let's see an example:
(function() {
  let originalData = {
    title: 'example value'
  };
  let targetData = {};
  Object.assign(targetData, originalData);
  targetData.title = 'updated value';
  console.log('source and target', {
    original: originalData.title,
    target: targetData.title
  });
})();In your case I assume you can do the following:
toBarChart =  function (d){
  var tData = [{values: []}];
    Object.assign(d, tData[0].values)
  return tData;
} 
    
    lodash is good for deep copying in Angular
import * as _ from 'lodash';
let newCopy = _.cloneDeep(objectToBeCopied);
 
    
    You can Try cloneDeep function from lodash.
 
    
    