all files / sankey/print-export/ export.js

93.55% Statements 29/31
100% Branches 6/6
88.89% Functions 8/9
93.55% Lines 29/31
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50   253×                               1387×          
define(["require", "exports", "../../common/utils/export", "../../common/model/constants"], function (require, exports, export_1, constants_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var SankeyExport = (function () {
        function SankeyExport(chart) {
            this.chart = chart;
        }
        SankeyExport.prototype.export = function (type, fileName) {
            var exportChart = new export_1.ExportUtils(this.chart);
            var exportEventArgs = {
                cancel: false, width: null, height: null
            };
            this.chart.trigger(constants_1.beforeExport, exportEventArgs);
            if (!exportEventArgs.cancel) {
                exportChart.export(type, fileName, undefined, [this.chart]);
                this.chart.trigger('afterExport', exportEventArgs);
            }
        };
        SankeyExport.prototype.pdfExport = function (fileName, orientation, controls, width, height, isVertical, header, footer, exportToMultiplePages) {
            var exportChart = new export_1.ExportUtils(this.chart);
            controls = controls ? controls : [this.chart];
            var exportEventArgs = {
                cancel: false, width: width, height: height
            };
            this.chart.trigger(constants_1.beforeExport, exportEventArgs);
            if (!exportEventArgs.cancel) {
                exportChart.export('PDF', fileName, orientation, controls, width = exportEventArgs.width, height = exportEventArgs.height, isVertical, header, footer, exportToMultiplePages);
                this.chart.trigger('afterExport', exportEventArgs);
            }
        };
        SankeyExport.prototype.getDataUrl = function (chart) {
            var exportUtil = new export_1.ExportUtils(chart);
            return exportUtil.getDataUrl(chart);
        };
        SankeyExport.prototype.triggerBeforePrint = function (htmlContent) {
            var exportEventArgs = {
                cancel: false, htmlContent: htmlContent
            };
            this.chart.trigger('beforePrint', exportEventArgs);
        };
        SankeyExport.prototype.getModuleName = function () {
            return 'SankeyExport';
        };
        SankeyExport.prototype.destroy = function () {
        };
        return SankeyExport;
    }());
    exports.SankeyExport = SankeyExport;
});