title: Creating an array of objects for a graph in AngularJS
body: <p>I'm using n-3 charts (<a href="http://n3-charts.github.io/" rel="nofollow">http://n3-charts.github.io/</a>) to create some graphs in my angular web app. Here is some sample data of some points where there is a data values with 3 series:</p>
  
  <pre><code>$scope.data = [
        {x: new Date(1391448620668), current: 0, baseline: 0, original: 0, val_3: 0},
        {x: new Date(1391535020668), current: 0.993, baseline: 3.894, original: 8.47, val_3: 14.347},
        {x: new Date(1391621420668), current: 1.947, baseline: 7.174, original: 13.981, val_3: 19.991},
        {x: new Date(1391707820668), current: 2.823, baseline: 9.32, original: 14.608, val_3: 13.509},
        {x: new Date(1391794220668), current: 3.587, baseline: 9.996, original: 10.132, val_3: -1.167},
  ];
  </code></pre>
  
  <p>In my code I'm trying to create this under that same construct like so:</p>
  
  <pre><code>$scope.addGraphData = function(){
    var firstSubDate  = $scope.FirstSubjectDoseDt;
    var xValues = new Array(); // date data points
    var cValues = new Array(); // current values
    var bValues = new Array(); // baseline values
    var oValues = new Array(); // original baseline values
  
    for (var i = 0; i &lt; $scope.currentData.length; i++) {
      xValues[i] = new Date(firstSubDate+([i]*2628000000));
      cValues[i] = $scope.currentData[i].currentValue;
      bValues[i] = $scope.currentData[i].baselineValue;
      oValues[i] = $scope.currentData[i].origValue;
    };
  
    for (var i = 0; i &lt; $scope.currentData.length; i++) {
      $scope.data[i] = {x: xValues[i], current: cValues[i], baseline: bValues[i], original: oValues[i]};
    };
    console.log("Graph Data: " + $scope.data);
  };
  </code></pre>
  
  <p>But the values in the $scope.data array exist, but the console gives me</p>
  
  <p><code>Graph Data: [object Object],[object Object],[object Object]</code></p>
  
  <p>for my 3 data points and it plots nothing. Where am I going wrong here?</p>