title: Random number on Highcharts + AngularJS
body: <p>I'm trying to create a chart that generates random numbers and it updates the maximum value after clicking on a button.</p>
  
  <p>This is my controller:</p>
  
  <pre><code>$scope.max = 1;
  
  $scope.randomNumber = function(max,min) {
    var arr = [];
    for (var i = 0; i &lt; 60; i++) {
      arr.push(Math.floor(Math.random()*(max-min+1)+min));
    }
    return arr;
  }
  
    $('#chart').highcharts({
      series: [{
        data: (function () {
          var data = [];
  
          for (var i = 0; i &lt; 60; i++) {
            data.push({
              x: i,
              y: $scope.randomNumber($scope.max,0)[0]
            });
          }
          return data;
        }())
      }]
    });
  </code></pre>
  
  <p>And this is the HTML that should update the maximum value:</p>
  
  <pre><code>&lt;button ng-click="max = 10"&gt;10&lt;/button&gt;
  &lt;button ng-click="max = 100"&gt;100&lt;/button&gt;
  &lt;button ng-click="max = 1000"&gt;1000&lt;/button&gt;
  &lt;button ng-click="max = 10000"&gt;10000&lt;/button&gt;
  </code></pre>
  
  <p>However, it's not updating the maximum value. Any tips?</p>
  
  <p>Here's a Plunker: <a href="http://plnkr.co/edit/N0UfORtSjYW5jaPGojXH?p=preview" rel="nofollow">http://plnkr.co/edit/N0UfORtSjYW5jaPGojXH?p=preview</a></p>