title: Generating random data at 1 minute intervals: Highcharts
body: <p>I have created a spline real time chart where I want to show points at regular intervals.</p>
  
  <p>Every point is an event taking place after one minute. However I am having a hard time trying to understand all the moving pieces:</p>
  
  <ol>
  <li><p>the interval function on the highchart demo I referred updated every 1 second, I have made that 6000.</p></li>
  <li><p>the dummy updating in the javascript just takes the latest time and appends it, is there supposed to be some delay introduced there?</p></li>
  <li><p>the dummy initialization data in series has a for loop which again I could not understand. I understand that javascript produces a UNIX timestamp and its millisecond manipulation however the default code (again slightly modified from a highchart demo) runs from -9999 to 0 and multiples by a number.</p></li>
  </ol>
  
  <p>I want to understand these parts and make sure that every time my x axis 'ticks' towards the right, I have a one minute gap and only one point on the graph.</p>
  
  <p>PS: Please forgive any missing brackets, they might have been missed while posting the question, but I assure you that it isnt a problem.</p>
  
  <p>Here is my code for series:</p>
  
  <pre><code>           series: [{
                  type: 'spline',
                  name: 'Random data',
                  data: (function () {
                      // generate an array of random data
                      var data = [],
                          time = (new Date()).getTime(),
                          i;
  
                      for (i = -9999; i &lt;= 0; i += 1) {
                          data.push([
                              time + i * 60000,
                              Math.round(Math.random() * 100) + 10
                          ]);
                      }
                      return data;
                  }())
              }]
  </code></pre>
  
  <p>Here is my code for the chart:</p>
  
  <pre><code>chart: {
   events: {
             load: function () {
  
               // Set up the updating 
               var series = this.series[0];
  
               setInterval(function () {
                 var x = (new Date()).getTime(), // current time
                 y = Math.round(Math.random() * 100) + 10
  
                 series.addPoint([x, y], true, true);
               }, 6000);
             }
           }
         }
  </code></pre>