title: Live chart using jqPlot: Performance issue
body: <p>For a project I need to implement a live update chart using jqPlot.</p>
  
  <p>Please see the following jsFiddle: <a href="http://jsfiddle.net/fracu/HrZcj/242/" rel="nofollow">http://jsfiddle.net/fracu/HrZcj/242/</a>
  (for the sake of simplicity the values are generated randomly)</p>
  
  <p>I successfully managed to do the job, but I'm having performance issues: After some minutes with the chart running the browser starts getting slow till the moment when I close the chart's tab. (tested with Firefox and Chrome)</p>
  
  <p>I can't see where the problem is, since I'm not doing anything special, just replotting the chart every n seconds with an array where the chart values are stored.</p>
  
  <p>Another issue I'm having is that when I resize the x axis the "ticks" are positioned on the left of the chart and they are not distributed equally along the axis.</p>
  
  <p>Could you please give me a clue on what could be happening?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Javascript:</p>
  
  <pre><code>    var plot1 = $.jqplot('chart1', [new Array(1)], {
          series: [{yaxis:'y2axis',showMarker:true,fill:false,neighborThreshold:3,rendererOptions:{smooth:true}}],
          axes: {
              xaxis: {renderer: $.jqplot.DateAxisRenderer,tickOptions:{formatString:'%H:%M:%S'}},
              y2axis:{tickOptions:{formatString:'%.2f'}}
          },
      });
  
      var myData = [], x, y, samples = 0, secsBuffer = 60, refreshInterval = 1, sampleWindow = secsBuffer / refreshInterval;
  
      $("#refreshInterval").change(function () {
          clearInterval(cInt);
          cInt = window.setInterval(updateSeries, $("#refreshInterval").val() * 1000);
          refreshInterval = $("#refreshInterval").val();
          sampleWindow = secsBuffer / refreshInterval;
      });
  
      $("#secsBuffer").change(function () {
          secsBuffer = $("#secsBuffer").val();
          sampleWindow = secsBuffer / refreshInterval;
      });
  
      function updateSeries() {
          if (samples &gt; sampleWindow) {
              var diff = samples - sampleWindow;
              myData.splice(0, diff);
              samples -= diff;
          }
          x = (new Date()).getTime();
          y = Math.floor(Math.random() * 100);
          myData.push([x, y]);
  
          plot1.resetAxesScale();
          plot1.axes.xaxis.numberTicks = 15;
          plot1.axes.y2axis.numberTicks = 15;
          plot1.axes.xaxis.min = x - (secsBuffer * 1000);
          plot1.axes.xaxis.max = x;
          plot1.series[0].data = myData;
          plot1.replot();
          samples++;
      }
      cInt = window.setInterval(updateSeries, refreshInterval * 1000);
  </code></pre>