/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { fromEnum, markType } from "igniteui-angular-core";
import { NumericYAxis } from "./NumericYAxis";
import { NumericScaler } from "./NumericScaler";
import { AxisRange } from "./AxisRange";
import { PercentChangeAxisRenderer } from "./PercentChangeAxisRenderer";
import { isNaN_ } from "igniteui-angular-core";
import { AutoRangeCalculator } from "./AutoRangeCalculator";
/**
 * @hidden
 */
var PercentChangeYAxis = /** @class */ (function (_super) {
    tslib_1.__extends(PercentChangeYAxis, _super);
    function PercentChangeYAxis() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PercentChangeYAxis.prototype.ji = function () {
        return new VerticalPercentChangeScaler(this);
    };
    PercentChangeYAxis.prototype.jb = function () {
        var e_1, _a;
        var a = 1.7976931348623157E+308;
        var b = -1.7976931348623157E+308;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.cu())), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                var d = c.an(this);
                if (d == null) {
                    continue;
                }
                var e = c.eh();
                if (isNaN_(e) || e == 0) {
                    continue;
                }
                var f = d.b - e;
                var g = e - d.c;
                var h = Math.abs(f / e * 100);
                var i = Math.abs(g / e * 100);
                a = Math.min(a, -i);
                b = Math.max(b, h);
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
        return new AxisRange(a, b);
    };
    PercentChangeYAxis.prototype.je = function (a) {
        return new PercentChangeAxisRenderer(a);
    };
    PercentChangeYAxis.prototype.j$c = function (a, b) {
        return this.dz.apply(this, arguments);
    };
    PercentChangeYAxis.prototype.j$b = function (a, b) {
        return this.dw.apply(this, arguments);
    };
    PercentChangeYAxis.prototype.j$d = function (a, b, c, d, e) {
        this.gm.apply(this, arguments);
    };
    PercentChangeYAxis.prototype.j$e = function (a, b, c, d) {
        this.gn.apply(this, arguments);
    };
    PercentChangeYAxis.prototype.j$f = function (a, b, c, d) {
        this.go.apply(this, arguments);
    };
    Object.defineProperty(PercentChangeYAxis.prototype, "j$a", {
        get: function () {
            return this.b8;
        },
        enumerable: true,
        configurable: true
    });
    PercentChangeYAxis.$t = markType(PercentChangeYAxis, 'PercentChangeYAxis', NumericYAxis.$);
    return PercentChangeYAxis;
}(NumericYAxis));
export { PercentChangeYAxis };
/**
 * @hidden
 */
var VerticalPercentChangeScaler = /** @class */ (function (_super) {
    tslib_1.__extends(VerticalPercentChangeScaler, _super);
    function VerticalPercentChangeScaler(a) {
        var _this = _super.call(this) || this;
        _this.ad = null;
        _this.ad = a;
        return _this;
    }
    VerticalPercentChangeScaler.prototype.t = function (a, b, c, d, e) {
        var f = AutoRangeCalculator.a(this.ad, b, c, false, -1, d, e);
        d = f.p5;
        e = f.p6;
        return {
            p3: d,
            p4: e
        };
    };
    VerticalPercentChangeScaler.prototype.p = function (a, b) {
        var c;
        if (isNaN_(b.b)) {
            c = a;
        }
        else {
            var d = (a - b.b) / Math.abs(b.b) * 100;
            c = d;
        }
        var e = (c - this.o) / this.m;
        if (!b.a) {
            e = 1 - e;
        }
        return b.d.top + b.d.height * (e - b.e.top) / b.e.height;
    };
    VerticalPercentChangeScaler.prototype.q = function (a, b) {
        var c = b.e.top + b.e.height * (a - b.d.top) / b.d.height;
        if (!b.a) {
            c = 1 - c;
        }
        return this.o + c * (this.m);
    };
    VerticalPercentChangeScaler.$t = markType(VerticalPercentChangeScaler, 'VerticalPercentChangeScaler', NumericScaler.$);
    return VerticalPercentChangeScaler;
}(NumericScaler));
export { VerticalPercentChangeScaler };
//# sourceMappingURL=PercentChangeYAxis_combined.js.map