title: jqPlot display button
body: <p>I am using jqPlot to create and display charts. </p>
  
  <p>Can I please have some help to display a button on the same page as the graph that will enable  an image to be created of the chart so that the image can be saved to file.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script class="code" type="text/javascript"&gt;
  $(document).ready(function(){
  var cosPoints = []; 
  for (var i=0; i&lt;2*Math.PI; i+=0.1){ 
   cosPoints.push([i, Math.cos(i)]); 
  } 
    var plot1 = $.jqplot('chart1', [cosPoints], {  
    series:[{showMarker:false}],
    axes:{
      xaxis:{
        label:'Angle (radians)'
      },
      yaxis:{
        label:'Cosine'
      }
    }
  });
  
  var c = $(document.createElement("button"));
  c.text("View Plot Image test");
  c.addClass("jqplot-image-button");
  c.bind("click", {
      chart: $(this)
  }, function (h) {
      var j = h.data.chart.jqplotToImageElem();
      var i = $(this).nextAll("div.jqplot-image-container").first();
      i.children("div.jqplot-image-container-content").empty();
      i.children("div.jqplot-image-container-content").append(j);
      i.show(500);
      i = null
      });
  
  var c = $("&lt;button type='button'&gt;&lt;/button&gt;")
  .text('View Plot Image test')
  .addClass('jqplot-image-button')
  .insertAfter($('#chart1'));
  
  });
  </code></pre>
  
  <p></p>
  
  <p>The graph and button are shown. However, if I click on the button, no graph is shown to be saved. Can I please have some help to fix this?</p>