title: Use an array of objects for series data in Highcharts
body: <p>I have an array of objects that I want to display in highcharts.  Every object has a name and a value.</p>
  
  <p>I have tried to get this to work by doing</p>
  
  <pre><code>var objects = objectArray[]; // objectArray being an array of the objects I want data on
  var objectNames = nameArray[]; // This being an array of all the names of the objects
  var objectValues = valueArray[]; // An array of all the values of the objects
  
  
   series: [{
      data: objects.value,
      name: objects.name
   }]
  </code></pre>
  
  <p>This blew up on me.  So I tried building the series like this:</p>
  
  <pre><code> series: [{
      data: objectValues,
      name: objectNames
   }]
  </code></pre>
  
  <p>This gave me data for the values, but the name was all of the names in the objectNames array... for every single piece of data.  so I tried using</p>
  
  <pre><code>series: [{
      data: objectValues
  },
  {   
      data: objectNames
  }]
  </code></pre>
  
  <p>This resulted in seeing the chart for the objectValues, and in the legend, another option for the names - which is completely unacceptable because there's no point in having a series of labels, right?</p>
  
  <p>So I decided I would programmatically build out a series, using a foreach loop and then pass that into the constructor.  However, <a href="http://www.highcharts.com/docs/getting-started/how-to-set-options/" rel="noreferrer">http://www.highcharts.com/docs/getting-started/how-to-set-options/</a> says this is "bad code".</p>
  
  <p>What I'm wanting is to be able to pass an array of objects to highcharts, tell it that every piece of data's 'name' is going to be the name value on that particular object, and the data is going to be tied to that particular object's value field.  Is there a way to do this? Or is the only option what highcharts considers 'bad'?</p>