title: highcharts dynamically adding series with addSeries
body: <p>I'm working on creating a dynamically created chart that will add a series if there isn't one and if there is one add a point. I'm getting an Uncaught TypeError: Cannot call method 'addSeries' of undefined. I've looked around and I can't find why it says that method is undefined.</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="highcharts.js"&gt;&lt;/script&gt;
  $(document).ready(function () {
  
      var chart1 = new Highcharts.Chart({
          chart: {
              renderTo: 'container',
              type: 'column',
              events: {
                  load: requestData
              }
          },
          title: {
              text: 'Survey Chart'
  
          },
          xAxis: {
              categories: [],
              title: {
                  text: 'Question Number'
              }
  
          },
          yAxis: {
              title: {
                  text: 'Total Answered'
              }
          },
          legend: {
              layout: 'vertical',
              align: 'left',
              verticalAlign: 'top',
              x: 100,
              y: 70,
              floating: true
          },
          series: []
      });
  </code></pre>
  
  <p>with the document ready function taking up the entire script i have the following functions</p>
  
  <pre><code>    function requestData() {
      ajaxCall(chartCreate, createSeries, "services/Survey.svc/DoWork", "{}");
      chart1.redraw();
  };
  
  
  function chartCreate(point) {
      var temp;
      temp = $.parseJSON(point.d);
      $.each(temp, function (key, p) {
          var seriesObj;
          seriesObj = seriesExists(p.mcAnswer);
          if (seriesObj.status == false) {
              chart1.addSeries({name: '' + p.mcAnswer + '', data: [] });
              chart1.series[seriesObj.count].addPoint(p.total, false);
          } else {
              chart1.series[seriesObj.count].addPoint(p.total, false);
          }
      });
  };
  
  //loops through all the series to see if the series exists.
  //if true returns index and true if not just returns false
  function seriesExists(name) {
      var ct = 0;
      //var len = chart1.series.length;
      var len = 0;
      if (len &gt; 0) {
          $.each(chart1.series, function (count, curSeries) {
              if (curSeries.name == name) {
                  return { 'count': count, 'status': true };
              }
              ct = count;
          });
      }
      return { 'count': ct, 'status': false };
  };    function createSeries() {
      alert("error");
  };
  
  //$.ajaxCall({successFun: function, errorFun: function, source: "", data: {}});
  function ajaxCall(myFunSuccess, myFunError, url, data) {
      //chart1 = chartTemp;
      $.ajax({
          type: "POST",
          async: false,
          url: url,
          data: data,
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: myFunSuccess,
          error: myFunError
      });
      //return chart1;
  };
  </code></pre>
  
  <p>I'm able to use the ajax function call fine it's when I get to my chartCreate where I run into the problem.</p>