title: Highcharts series- Hiding/revealing a series via button
body: <p>I try to reveal/hide a series in a bar chart with a code adapted from <a href="https://stackoverflow.com/questions/8880748/hiding-a-highcharts-series-without-using-the-legend">here</a></p>
  
  <p>My chart pulls data from a text file. so that I am using this code</p>
  
  <pre><code>   $(function () {
          var chart1;
          $.get('graphdata/INDICAVGOTHERS.txt?x='+microtime(), function(json){
          obj = eval('({'+json+'})');
  
          var $container = $('#container');
              $(document).ready(function() {
                  chart1 = new  Highcharts.Chart(obj)
              });
          });
      });
  
     $(function () {
  
      // the button action
      var chart = $('#container').highcharts(),
          $button = $('#button');
      $button.click(function () {
          var series = chart.series[1];
          if (series.visible) {
              series.hide();
              $button.html('Show series');
          } else {
              series.show();
              $button.html('Hide series');
          }
      });
  </code></pre>
  
  <p>The button appears but does nothing. Any idea?</p>
  
  <p>Thanks</p>