title: Highcharts issue updating chart type: not recognizing highcharts functions
body: <p>I am trying to update my current highchart that I have to a new chart type, however I am having difficulty doing so. </p>
  
  <p>I have embedded javascript in my page, the following is below</p>
  
  <pre><code>&lt;script&gt;
  
  
  chart = $(function () {
      $('#chart_example').highcharts({
          chart: {
              type: 'line'
          },
          title: {
              text: 'Traffic'
          },
          xAxis: {
              categories: ['November', 'December', 'January']
          },
          yAxis: {
              title: {
                  text: 'Views'
              }
          },
          series: [{
              name: 'Hello',
              data: [50, 30, 60]
          }]
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>I have the following two scripts below at the bottom of the page</p>
  
  <pre><code>&lt;script src="http://code.highcharts.com/highcharts.js"&gt;&lt;/script&gt;
  ....
  &lt;script src="custom_script"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Inside the custom script, I want to update the highcharts library from a line graph into a bar graph. I looked at the API and found an <a href="http://api.highcharts.com/highcharts#Axis.update" rel="nofollow">update method</a>
  that takes in new options. So I tried the following:</p>
  
  <pre><code>$(document).on('click' , '#button' , function() {
       var options = new Object();
        options.chart = new Object();
        options.chart.type = 'bar';
        options.chart.renderTo = 'container';
        chart.update(options, true);
        //the container the chart is in
        $('#chart_example').show();
  ...
  </code></pre>
  
  <p>However I get</p>
  
  <pre><code>Uncaught TypeError: chart.update is not a function(anonymous function) @ custom_script=1:41m.event.dispatch @ jquery.min.js:3m.event.add.r.handle @ jquery.min.js:3
  </code></pre>
  
  <p>My thought was that the order of the javascript is wrong but I seem to have the javascript in the right order. My questions are then:</p>
  
  <p>1) Is this chart variable set correctly? My understanding is that a variable that is unset with var is automatically global.<br>
  2) What is the cause of this error and how do I fix it so that it updates properly?<br></p>
  
  <p>Thank you in advance!</p>