amcharts export.js 与 prototype.js 冲突?

amcharts export.js conflict with prototype.js?

我正在使用 amcharts 创建图表。我还使用 prototype.js 动态获取图表的 dataProvider。但是当我尝试使用 amCharts 的导出功能下载图表时,出现以下错误:

无法读取 属性 未定义的“_calcWidth”

现在,当我删除 prototype.js 脚本然后再次执行下载时,它运行正常。

这里是下载函数:

 //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 < 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 < 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";
                }
            });
        });
    }
}

我联系了 amchart 支持团队,他们告诉我在他们的下一个版本中,这个问题将得到解决。我们所要做的就是等待。 :)