title: amcharts export.js conflict with prototype.js?
body: <p>I am using amcharts to create charts. I am also using prototype.js to dynamically fetch dataProvider for the charts. But when I try to download the chart using the export capabilities of amCharts, I get following error:</p>
  
  <p>Cannot read property '_calcWidth' of undefined </p>
  
  <p>Now, when I remove the prototype.js script and then perform the download again, then it runs okay. </p>
  
  <p>here is the download function:</p>
  
  <pre><code> //charts[] contains all the amcharts.
   function downloadReport() {
      // iterate through all of the charts and prepare their images for export
      var images = [];
      var pending = charts.length;
      for (var i = 0; i &lt; charts.length; i++) {
          var chart = charts[i];
          var content = [];
          chart.export.capture({}, function () {
              var dataArray = this.toArray({
                  withHeader: true
              });
              var columns = dataArray[0].length;
              var columnWidths = (Array(columns).join("auto,") + "*").split(","); // ["auto", ... "*"]
              //
              // EXTRA LOGS TO CHECK THE NUMBER OF COLUMNS (ALL SHOULD BE THE SAME)
              console.log("header: ", columns);
              console.log("widths: ", columnWidths.length);
              for (var i2 = 0; i2 &lt; dataArray.length; i2++) {
                  console.log("columns: ", dataArray[i2].length);
              }
  
              // GENERATE IMAGE
              this.toJPG({}, function (data) {
  
                  // ADD IMAGE
                  content.push({
                      "image": data,
                      "fit": [523.28, 769.89] // A4 Dimensions less 20px because of the page margins
                  });
  
                  // ADD TABLE
                  content.push({
                      layout: 'headerLineOnly',
                      margin: [0, 20, 0, 0], // [left, top, right, bottom]
                      table: {
                          headerRows: 1,
                          widths: columnWidths,
                          body: dataArray
                      }
                  });
  
                  pending--;
                  if (pending === 0) {
                      // all done - construct PDF
                      chart.export.toPDF({
                          content: content
                      }, function (data) {
                          this.download(data, "application/pdf", "NPGroupReportDeck_LNIndiaTracker.pdf");
                      });
  
                      // ADD PAGE BREAK
                  } else {
                      content[content.length - 1].pageBreak = "after";
                  }
              });
          });
      }
  }
  </code></pre>